Skip to content

AutoETS

AutoETS

class AutoETS(error='add', trend=None, damped_trend=False, seasonal=None, sp=1, initialization_method='estimated', initial_level=None, initial_trend=None, initial_seasonal=None, bounds=None, dates=None, freq=None, missing='none', start_params=None, maxiter=1000, full_output=True, disp=False, callback=None, return_params=False, auto=False, information_criterion='aic', allow_multiplicative_trend=False, restrict=True, additive_only=False, ignore_inf_ic=True, n_jobs=None, random_state=None)[source]

ETS models with both manual and automatic fitting capabilities.

Manual (fixed parameter) use (auto=False, default) is a direct interface to statsmodels ETSModel [2], while automated tuning (auto=True) is an adaptation of the R version of ets [3], on top of statsmodels ETSModel.

The first parameters are direct interfaces to the statsmodels parameters (from error to return_params) [2].

The remaining parameters are adaptations of the parameters of R ets (auto to additive_only) [3], and are used for automatic model selection.

Parameters:
errorstr, default=”add”

The error model. Takes one of “add” or “mul”. Ignored if auto=True.

trendstr or None, default=None

The trend component model. Takes one of “add”, “mul”, or None. Ignored if auto=True.

damped_trendbool, default=False

Whether or not an included trend component is damped. Ignored if auto=True.

seasonalstr or None, default=None

The seasonality model. Takes one of “add”, “mul”, or None. Ignored if auto=True.

spint, default=1

The number of periods in a complete seasonal cycle for seasonal (Holt-Winters) models. For example, 4 for quarterly data with an annual cycle or 7 for daily data with a weekly cycle. Required if seasonal is not None.

initialization_methodstr, default=’estimated’

Method for initialization of the state space model. One of:

  • ‘estimated’ (default)

  • ‘heuristic’

  • ‘known’

If ‘known’ initialization is used, then initial_level must be passed, as well as initial_trend and initial_seasonal if applicable. ‘heuristic’ uses a heuristic based on the data to estimate initial level, trend, and seasonal state. ‘estimated’ uses the same heuristic as initial guesses, but then estimates the initial states as part of the fitting process. Default is ‘estimated’.

initial_levelfloat or None, default=None

The initial level component. Only used if initialization is ‘known’.

initial_trendfloat or None, default=None

The initial trend component. Only used if initialization is ‘known’.

initial_seasonalarray_like or None, default=None

The initial seasonal component. An array of length seasonal_periods. Only used if initialization is ‘known’.

boundsdict or None, default=None

A dictionary with parameter names as keys and the respective bounds intervals as values (lists/tuples/arrays). The available parameter names are, depending on the model and initialization method:

  • “smoothing_level”

  • “smoothing_trend”

  • “smoothing_seasonal”

  • “damping_trend”

  • “initial_level”

  • “initial_trend”

  • “initial_seasonal.0”, …, “initial_seasonal.<m-1>”

The default option is None, in which case the traditional (nonlinear) bounds as described in [1] are used.

start_paramsarray_like or None, default=None

Initial values for parameters that will be optimized. If this is None, default values will be used. The length of this depends on the chosen model. This should contain the parameters in the following order, skipping parameters that do not exist in the chosen model.

  • smoothing_level (alpha)

  • smoothing_trend (beta)

  • smoothing_seasonal (gamma)

  • damping_trend (phi)

If initialization_method was set to 'estimated' (the default), additionally, the parameters

  • initial_level (\(l_{-1}\))

  • initial_trend (\(l_{-1}\))

  • initial_seasonal.0 (\(s_{-1}\))

  • initial_seasonal.<m-1> (\(s_{-m}\))

also have to be specified.

maxiterint, default=1000

The maximum number of iterations to perform.

full_outputbool, default=True

Set to True to have all available output in the Results object’s mle_retvals attribute. The output is dependent on the solver. See LikelihoodModelResults notes section for more information.

dispbool, default=False

Set to True to print convergence messages.

callbackcallable callback(xk) or None, default=None

Called after each iteration, as callback(xk), where xk is the current parameter vector.

return_paramsbool, default=False

Whether or not to return only the array of maximizing parameters.

autobool, default=False

Set True to enable automatic model selection. If auto=True, then error, trend, seasonal and damped_trend are ignored.

information_criterionstr, default=”aic”

Information criterion to be used in model selection. One of:

  • “aic”

  • “bic”

  • “aicc”

allow_multiplicative_trendbool, default=False

If True, models with multiplicative trend are allowed when searching for a model. Otherwise, the model space excludes them.

restrictbool, default=True

If True, the models with infinite variance will not be allowed.

additive_onlybool, default=False

If True, will only consider additive models.

ignore_inf_ic: bool, default=True

If True models with negative infinity Information Criterion (aic, bic, aicc) will be ignored.

n_jobsint or None, default=None

The number of jobs to run in parallel for automatic model fitting. None means 1 unless in a joblib.parallel_backend context. -1 means using all processors.

random_stateint, RandomState instance or None, optional ,

default=None - If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by np.random.

Attributes:
cutoff

Cut-off = “present time” state of forecaster.

fh

Forecasting horizon that was passed.

is_fitted

Whether fit has been called.

state

State of the estimator.

See also

StatsForecastAutoETS

References

[1]

Hyndman, R.J., & Athanasopoulos, G. (2019) Forecasting: principles and practice, 3rd edition, OTexts: Melbourne, Australia. OTexts.com/fpp3. Accessed on April 19th 2020.

Examples

>>> from sktime.datasets import load_airline
>>> from sktime.forecasting.ets import AutoETS
>>> y = load_airline()
>>> forecaster = AutoETS(auto=True, n_jobs=-1, sp=12)
>>> forecaster.fit(y)
AutoETS(...)
>>> y_pred = forecaster.predict(fh=[1,2,3])

Methods

check_is_fitted([method_name])

Check if the estimator has been fitted.

clone()

Obtain a clone of the object with same hyper-parameters and config.

clone_tags(estimator[, tag_names])

Clone tags from another object as dynamic override.

create_test_instance([parameter_set])

Construct an instance of the class, using first test parameter set.

create_test_instances_and_names([parameter_set])

Create list of all test instances and a list of names for them.

fit(y[, X, fh])

Fit forecaster to training data.

fit_predict(y[, X, fh, X_pred])

Fit and forecast time series at future horizon.

get_class_tag(tag_name[, tag_value_default])

Get class tag value from class, with tag level inheritance from parents.

get_class_tags()

Get class tags from class, with tag level inheritance from parent classes.

get_config()

Get config flags for self.

get_fitted_params([deep])

Get fitted parameters.

get_param_defaults()

Get object's parameter defaults.

get_param_names([sort])

Get object's parameter names.

get_params([deep])

Get a dict of parameters values for this object.

get_pretrained_params([deep])

Get pretrained parameters of this estimator.

get_tag(tag_name[, tag_value_default, ...])

Get tag value from instance, with tag level inheritance and overrides.

get_tags()

Get tags from instance, with tag level inheritance and overrides.

get_test_params([parameter_set])

Return testing parameter settings for the estimator.

is_composite()

Check if the object is composed of other BaseObjects.

load_from_path(serial)

Load object from file location.

load_from_serial(serial)

Load object from serialized memory container.

predict([fh, X])

Forecast time series at future horizon.

predict_interval([fh, X, coverage])

Compute/return prediction interval forecasts.

predict_proba([fh, X, marginal])

Compute/return fully probabilistic forecasts.

predict_quantiles([fh, X, alpha])

Compute/return quantile forecasts.

predict_residuals([y, X])

Return residuals of time series forecasts.

predict_var([fh, X, cov])

Compute/return variance forecasts.

pretrain(y[, X, fh])

Pre-train forecaster on panel (global) data.

reset()

Reset the object to a clean post-init state.

save([path, serialization_format])

Save serialized self to bytes-like object or to (.zip) file.

score(y[, X, fh])

Scores forecast against ground truth, using MAPE (non-symmetric).

set_config(**config_dict)

Set config flags to given values.

set_params(**params)

Set the parameters of this object.

set_random_state([random_state, deep, ...])

Set random_state pseudo-random seed parameters for self.

set_tags(**tag_dict)

Set instance level tag overrides to given values.

summary()

Get a summary of the fitted forecaster.

update(y[, X, update_params])

Update cutoff value and, optionally, fitted parameters.

update_predict(y[, cv, X, update_params, ...])

Make predictions and update model iteratively over the test set.

update_predict_single([y, fh, X, update_params])

Update model with new data and make forecasts.