Back to models
Forecaster

PluginParamsForecaster

Categorical in XInsamplePred int insampleExogenousMultivariate

Plugs parameters from a parameter estimator into a forecaster.

Quickstart

python
from sktime.param_est.plugin import PluginParamsForecaster

estimator = PluginParamsForecaster(param_est, forecaster, params=None, update_params=False)

Parameters(4)

param_estsktime estimator object with a fit method, inheriting from BaseEstimator

e.g., estimator inheriting from BaseParamFitter or forecaster this is a “blueprint” estimator, state does not change when fit is called

forecastersktime forecaster, i.e., estimator inheriting from BaseForecaster

this is a “blueprint” estimator, state does not change when fit is called

paramsNone, str, list of str, dict with str values/keys, optional, default=None

determines which parameters from param_est are plugged into forecaster where None: all parameters of param_est are plugged into forecaster only parameters present in both forecaster and param_est are plugged in list of str: parameters in the list are plugged into parameters of the same name only parameters present in both forecaster and param_est are plugged in str: considered as a one-element list of str with the string as single element dict: parameter with name of value is plugged into parameter with name of key only keys present in param_est and values in forecaster are plugged in

update_paramsbool, optional, default=False

whether fitted parameters by param_est_ are to be updated in self.update

Examples

>>> from sktime.datasets import load_airline
>>> from sktime.forecasting.naive import NaiveForecaster
>>> from sktime.param_est.plugin import PluginParamsForecaster
>>> from sktime.param_est.seasonality import SeasonalityACF
>>> from sktime.transformations.difference import Differencer
>>> 
>>> y = load_airline ()
>>> 
>>> # sp_est is a seasonality estimator
>>> # ACF assumes stationarity so we concat with differencing first
>>> sp_est = Differencer () * SeasonalityACF ()
>>> 
>>> # fcst is a forecaster with a "sp" parameter which we want to tune
>>> fcst = NaiveForecaster ()
>>> 
>>> # sp_auto is auto-tuned via PluginParamsForecaster
>>> sp_auto = PluginParamsForecaster (sp_est, fcst)
>>> 
>>> # fit sp_auto to data, predict, and inspect the tuned sp parameter
>>> sp_auto. fit (y, fh = [1, 2, 3 ]) PluginParamsForecaster(
... )
>>> y_pred = sp_auto. predict ()
>>> sp_auto. forecaster_. get_params ()["sp" ] 12
>>> # shorthand ways to specify sp_auto, via dunder, does the same
>>> sp_auto = sp_est * fcst
>>> # or entire pipeline in one go
>>> sp_auto = Differencer () * SeasonalityACF () * NaiveForecaster () using dictionary to plug “foo” parameter into “sp”
>>> from sktime.param_est.fixed import FixedParams
>>> sp_plugin = PluginParamsForecaster (
... FixedParams ({ "foo": 12 }), NaiveForecaster (), params = { "sp": "foo" }
... )