Skip to content

Varima and AutoVARIMA models for forecasting#665

Open
charavelg wants to merge 25 commits into
mainfrom
varima
Open

Varima and AutoVARIMA models for forecasting#665
charavelg wants to merge 25 commits into
mainfrom
varima

Conversation

@charavelg

@charavelg charavelg commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

Add VARIMA and AutoVARIMA models for forecasting.

Supports naive seasonality.
Supports variable length TS.

VARIMA uses scipy nelder-mead optimization when q>0
AutoVARIMA uses statsmodels kpss tests for stationarity

Based on https://otexts.com/fpp3/

TODO:

  • Improve docstrings
  • Add doc example
  • Add models into the variable length section in docs

@charavelg charavelg requested a review from rtavenar April 10, 2026 14:32
@codecov

codecov Bot commented Apr 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.75%. Comparing base (13bf0ea) to head (a34a8b5).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #665      +/-   ##
==========================================
+ Coverage   93.70%   94.75%   +1.05%     
==========================================
  Files          73       78       +5     
  Lines        6986     7538     +552     
==========================================
+ Hits         6546     7143     +597     
+ Misses        440      395      -45     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread tslearn/forecasting/_arima.py Outdated
Comment thread tests/test_forecasting.py
Comment thread tslearn/forecasting/_arima.py Outdated
# * :math:`\epsilon_{t-k}` are lagged errors
# * :math:`\epsilon_t` is white noise
#
# Fitting the model with data estimates the parameters :math:`c, \phi_1, ... \phi_p, \theta1, ..., \theta_q` through

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\theta1 -> \theta_1

# forecasted values depends on the last two values. Hence, forecasting with a horizon :math:`n > 1`
# will use computed values for :math:`n-1, ..., 1`.

from sklearn.metrics import mean_absolute_error

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use our own mae from the other PR?

# The AutoVARIMA model provides a way to automatically select the hyperparameters of the VARIMA model
# based on the training data. Selection of the order of differentiation :math:`d` aims at applying VARMA modeling onto
# stationary data whereas selection of :math:`p` and :math:`q` orders is driven by the minimization of AIC for
# relative VARMA models.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

relative -> related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants