Forecaster
UpdateEvery
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
yseen infitis integer oryis index-free container type,refit_intervalmust beint, and is interpreted as difference ofintlocationif index of
yseen infitis timestamp, must beintorpd.Timedeltaif
pd.Timedelta, will be interpreted as time since last refit elapsedif 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(
... )