Versions in this module Expand all Collapse all v0 v0.3.1 Sep 30, 2026 Changes in this version + var ErrConfig = errors.New("foresight: invalid configuration of the model") + var ErrForecast = errors.New("foresight: forecast is not finite") + var ErrHorizon = errors.New("foresight: negative horizon") + var ErrLevels = errors.New("foresight: levels must be above 0 and below 1") + func MaxThreads() int + func SetMaxThreads(n int) v0.3.0 Sep 30, 2026 Changes in this version + func Clean(values []float64, period int) ([]float64, bool) + func Interpolate(values []float64, period int) ([]float64, bool) type Candidate + func Thorough() []Candidate + type Choice int + const Choose + const No + const Yes + type Croston struct + Alpha float64 + Beta float64 + Optimised bool + Variant Intermittent + func (c Croston) Description() string + func (c Croston) Fit(y Series) (Fitted, error) + func (c Croston) Name() string + type Decomposed struct + Model Model + Periods []int + Robust bool + func (d Decomposed) Description() string + func (d Decomposed) Fit(y Series) (Fitted, error) + func (d Decomposed) Name() string + type Decomposition struct + Periods []int + Remainder []float64 + Seasonal [][]float64 + Trend []float64 + func (d Decomposition) SeasonalStrength(i int) (float64, bool) + func (d Decomposition) SeasonallyAdjusted() []float64 + func (d Decomposition) TrendStrength() float64 + type Ensemble struct + Horizon int + Members []Candidate + Origins int + Top int + Weighting Weighting + func (e Ensemble) Description() string + func (e Ensemble) Fit(y Series) (Fitted, error) + func (e Ensemble) Name() string + type Intermittent int + const CrostonMethod + const SBA + const TSB + type Mstl struct + Iterations int + Periods []int + Robust bool + Windows []int + func (m Mstl) Decompose(y []float64) (Decomposition, error) + type Outlier struct + Index int + Replacement float64 + Value float64 + func Outliers(values []float64, period int) ([]Outlier, bool) + type SeasonalPeriod struct + Harmonics int + Period float64 + type Stl struct + FlatLowPass bool + FlatTrend bool + Inner int + LowPassWindow int + Outer int + Period int + Robust bool + SeasonalLinear bool + SeasonalWindow int + TrendWindow int + func (s Stl) Decompose(y []float64) (Decomposition, error) + type Tbats struct + ArmaErrors Choice + BoxCox Choice + Damped Choice + FixOrders bool + Harmonics []int + P int + Periods []float64 + Q int + Trend Choice + func (Tbats) Description() string + func (Tbats) Name() string + func (t Tbats) Fit(y Series) (Fitted, error) + func (t Tbats) Select(y Series) (*TbatsFit, error) + type TbatsFit struct + Sigma2 float64 + func (f *TbatsFit) AIC() float64 + func (f *TbatsFit) Arma() (p, q int) + func (f *TbatsFit) Forecast(h int) []float64 + func (f *TbatsFit) InitialStates() []float64 + func (f *TbatsFit) Lambda() (float64, bool) + func (f *TbatsFit) Likelihood() float64 + func (f *TbatsFit) Params() []Param + func (f *TbatsFit) Residuals() []float64 + func (f *TbatsFit) Seasonal() []SeasonalPeriod + func (f *TbatsFit) Smoothing() (alpha, beta float64) + func (f *TbatsFit) Trend() (damping float64, ok bool) + type Weighting int + const EqualWeights + const InverseError + const Median + const Stacked v0.2.0 Sep 30, 2026 Changes in this version + const KPSS5Percent + const SeasonalStrengthThreshold + var ErrRegressors = errors.New("foresight: regressors do not cover the series or are collinear") + func Difference(y []float64, lag int) []float64 + func KPSS(y []float64) (float64, bool) + func NDiffs(y []float64, limit int) int + func NSDiffs(y []float64, period int) int + func SeasonalStrength(y []float64, period int) (float64, bool) + type Arima struct + Constant Constant + D int + P int + Q int + Regressors Regressors + SeasonalD int + SeasonalP int + SeasonalQ int + func Airline() Arima + func (a Arima) Description() string + func (a Arima) Estimate(y Series) (*ArimaFit, error) + func (a Arima) Fit(y Series) (Fitted, error) + func (a Arima) Name() string + type ArimaFit struct + AIC float64 + AICc float64 + AR []float64 + BIC float64 + Constant float64 + HasConstant bool + LogLikelihood float64 + MA []float64 + Regression []Param + Residuals []float64 + SeasonalAR []float64 + SeasonalMA []float64 + Sigma2 float64 + func (f *ArimaFit) Forecast(h int) []float64 + func (f *ArimaFit) ForecastVariance(h int) []float64 + func (f *ArimaFit) IsWellBehaved(margin float64) bool + func (f *ArimaFit) Order() (p, d, q int) + func (f *ArimaFit) Params() []Param + func (f *ArimaFit) Period() int + func (f *ArimaFit) SeasonalOrder() (p, d, q int) + type AutoArima struct + Criterion Criterion + D int + FixDifferences bool + MaxD int + MaxModels int + MaxP int + MaxQ int + MaxSeasonalD int + MaxSeasonalP int + MaxSeasonalQ int + Regressors Regressors + SeasonalD int + func DefaultAutoArima() AutoArima + func (AutoArima) Description() string + func (AutoArima) Name() string + func (a AutoArima) Fit(y Series) (Fitted, error) + func (a AutoArima) Select(y Series) (*ArimaFit, error) + type AutoEts struct + Criterion Criterion + func (AutoEts) Description() string + func (AutoEts) Name() string + func (a AutoEts) Fit(y Series) (Fitted, error) + func (a AutoEts) Select(y Series) (*EtsFit, error) + type BoxCox struct + Lambda float64 + func Guerrero(y Series) (BoxCox, bool) + func (b BoxCox) Apply(y float64) float64 + func (b BoxCox) Invert(z float64) float64 + type Changepoint struct + Change float64 + Position int + type Constant int + const ConstantByDefault + const WithConstant + const WithoutConstant + type Criterion int + const ByAIC + const ByAICc + const ByBIC + type ErrorKind int + const AdditiveError + const MultiplicativeError + type Ets struct + Error ErrorKind + Season Season + Trend Trend + func EtsCandidates(period int, positive bool) []Ets + func EtsFromCode(code string) (Ets, bool) + func (e Ets) Code() string + func (e Ets) Description() string + func (e Ets) Estimate(y Series) (*EtsFit, error) + func (e Ets) Fit(y Series) (Fitted, error) + func (e Ets) Name() string + type EtsFit struct + AIC float64 + AICc float64 + Alpha float64 + BIC float64 + Beta float64 + Fitted []float64 + Gamma float64 + LogLikelihood float64 + Phi float64 + Residuals []float64 + Sigma2 float64 + func (f *EtsFit) Forecast(h int) []float64 + func (f *EtsFit) InitialLevelAndTrend() (level, trend float64) + func (f *EtsFit) InitialSeasonal() []float64 + func (f *EtsFit) LevelAndTrend() (level, trend float64) + func (f *EtsFit) Model() Ets + func (f *EtsFit) Params() []Param + type Event struct + Name string + Positions []int + Step bool + StepFrom int + type Prophet struct + ChangepointPriorScale float64 + ChangepointRange float64 + Changepoints int + EventPriorScale float64 + Events []Event + FourierOrder int + NoChangepoints bool + NoSeasonality bool + SeasonalityPriorScale float64 + func DefaultProphet() Prophet + func (Prophet) Description() string + func (Prophet) Name() string + func (p Prophet) Estimate(y Series) (*ProphetFit, error) + func (p Prophet) Fit(y Series) (Fitted, error) + type ProphetFit struct + func (f *ProphetFit) Changepoints() []Changepoint + func (f *ProphetFit) Effects() []Param + func (f *ProphetFit) Events(i int) float64 + func (f *ProphetFit) FittedValues() []float64 + func (f *ProphetFit) Forecast(h int) []float64 + func (f *ProphetFit) Params() []Param + func (f *ProphetFit) Seasonal(i int) float64 + func (f *ProphetFit) Sigma() float64 + func (f *ProphetFit) Trend(i int) float64 + type Regressors struct + func Fourier(period float64, order, rows int) Regressors + func SeasonalDummies(period, rows int) Regressors + func (r Regressors) And(other Regressors) Regressors + func (r Regressors) Columns() [][]float64 + func (r Regressors) Covers(end int) bool + func (r Regressors) Names() []string + func (r Regressors) Rows() int + func (r Regressors) Width() int + func (r Regressors) With(name string, values []float64) Regressors + type Season int + const AdditiveSeason + const MultiplicativeSeason + const NoSeason + type Transformed struct + Automatic bool + Model Model + Transform BoxCox + func Log(m Model) Transformed + func WithBoxCox(m Model, lambda float64) Transformed + func WithGuerrero(m Model) Transformed + func (t Transformed) Description() string + func (t Transformed) Fit(y Series) (Fitted, error) + func (t Transformed) Name() string + type Trend int + const AdditiveTrend + const DampedTrend + const NoTrend v0.1.1 Sep 30, 2026 v0.1.0 Sep 30, 2026 Changes in this version + var ErrFewOrigins = errors.New("foresight: series too short for the backtest") + var ErrLength = errors.New("foresight: lengths differ") + var ErrNoCandidate = errors.New("foresight: no candidate could be fitted at every origin") + var ErrNoFit = errors.New("foresight: model could not be fitted") + var ErrNotFinite = errors.New("foresight: series has values that are not finite") + var ErrNotPositive = errors.New("foresight: model needs positive values") + var ErrNotSeasonal = errors.New("foresight: model needs a seasonal series") + var ErrTooShort = errors.New("foresight: series too short for the model") + func ACF(y []float64, maxLag int) []float64 + func Bias(actual, forecast []float64) float64 + func Forecast(m Model, y Series, h int) ([]float64, error) + func MAE(actual, forecast []float64) float64 + func MAPE(actual, forecast []float64) float64 + func MASE(actual, forecast []float64, scale float64) float64 + func MASEScale(train []float64, period int) (float64, bool) + func Quantile(v []float64, p float64) (float64, bool) + func RMSE(actual, forecast []float64) float64 + type Backtest struct + Combine int + Horizon int + Levels []float64 + Metric Metric + MinTrain int + Origins int + Sequential bool + Window int + func DefaultBacktest() Backtest + func (b Backtest) Run(y Series, candidates []Candidate) (*Report, error) + type Band struct + Level float64 + Lower float64 + Upper float64 + type Candidate struct + Description string + Model Model + Name string + func Defaults() []Candidate + func NewCandidate(m Model) Candidate + func (c Candidate) Named(name, description string) Candidate + type CandidateReport struct + Components []string + Description string + Forecast []Point + Horizons []HorizonStats + Name string + Params []Param + Score float64 + Trajectories [][]float64 + func (c CandidateReport) Cumulative(k int) (Point, bool) + type Drift struct + func (Drift) Description() string + func (Drift) Fit(y Series) (Fitted, error) + func (Drift) Name() string + type Fitted interface + Forecast func(h int) []float64 + Params func() []Param + type HoltWinters struct + func (HoltWinters) Description() string + func (HoltWinters) Fit(y Series) (Fitted, error) + func (HoltWinters) Name() string + type HorizonStats struct + Bands []Band + Bias float64 + Cumulative []Band + MAE float64 + MAPE float64 + MASE float64 + N int + RMSE float64 + type Interval struct + Level float64 + Lower float64 + Upper float64 + type LogLinear struct + Deflator []float64 + Window int + func (l LogLinear) Description() string + func (l LogLinear) Fit(y Series) (Fitted, error) + func (l LogLinear) Name() string + type Mean struct + func (Mean) Description() string + func (Mean) Fit(y Series) (Fitted, error) + func (Mean) Name() string + type Metric int + const RankByMAE + const RankByMAPE + const RankByMASE + const RankByRMSE + type Model interface + Description func() string + Fit func(y Series) (Fitted, error) + Name func() string + type Naive struct + func (Naive) Description() string + func (Naive) Fit(y Series) (Fitted, error) + func (Naive) Name() string + type Param struct + Name string + Value float64 + type Point struct + Horizon int + Intervals []Interval + Mean float64 + func (p Point) Interval(level float64) (Interval, bool) + type Report struct + Candidates []CandidateReport + Chosen int + FirstOrigin int + Horizon int + Metric Metric + Origins int + func (r *Report) Best() *CandidateReport + func (r *Report) Candidate(name string) (*CandidateReport, bool) + type SeasonalNaive struct + Growth bool + func (s SeasonalNaive) Description() string + func (s SeasonalNaive) Fit(y Series) (Fitted, error) + func (s SeasonalNaive) Name() string + type Series struct + func Monthly(values []float64, firstMonth int) Series + func NewSeries(values []float64, period int) Series + func NonSeasonal(values []float64) Series + func Quarterly(values []float64, firstQuarter int) Series + func (s Series) Head(n int) Series + func (s Series) Index(i int) int + func (s Series) IsFinite() bool + func (s Series) IsPositive() bool + func (s Series) Len() int + func (s Series) Period() int + func (s Series) Season(i int) int + func (s Series) Slice(from, to int) Series + func (s Series) Start() int + func (s Series) Tail(n int) Series + func (s Series) Values() []float64 + func (s Series) WithPhase(phase int) Series + func (s Series) WithValues(values []float64) (Series, error) + type Theta struct + func (Theta) Description() string + func (Theta) Fit(y Series) (Fitted, error) + func (Theta) Name() string