Back to models
Forecaster

UpdateEvery

Categorical in XInsamplePred int insampleExogenous

Update only periodically when update is called.

Quickstart

python
from sktime.forecasting.stream import UpdateEvery

estimator = UpdateEvery(forecaster, update_interval=None)

Parameters(1)

update_intervaldifference of sktime time indices (int or timedelta), optional

interval that needs to elapse until inner update call with update_params=True default = None = infinity, i.e., never updates

  • if index of y seen in fit is integer or y is index-free container type, refit_interval must be int, and is interpreted as difference of int location

  • if index of y seen in fit is timestamp, must be int or pd.Timedelta

    • if pd.Timedelta, will be interpreted as time since last refit elapsed

    • if int, will be interpreted as number of time stamps seen since last refit

Examples

>>> from sktime.forecasting.trend import TrendForecaster
>>> from sktime.forecasting.stream import UpdateEvery
>>> from sktime.datasets import load_airline
>>> y = load_airline ()
>>> y0 = y. iloc [: - 20 ]
>>> y1 = y. iloc [- 20: - 10 ]
>>> y2 = y. iloc [- 10:]
>>> inner_forecaster = TrendForecaster ()
>>> forecaster = UpdateEvery (inner_forecaster, update_interval = 12)
>>> forecaster. fit (y0, fh = [1, 2, 3 ]) UpdateEvery(
... )
>>> # predict etc could be called here
>>> # e.g., forecaster.predict()
>>> 
>>> # first update, 10 < update_interval = 12, so calls update with
>>> # update_params=False
>>> forecaster. update (y1) UpdateEvery(
... )
>>> # second update, 20 >= update_interval = 12, so calls update with
>>> # update_params=True
>>> forecaster. update (y2) UpdateEvery(
... )