SarimaxWrapper¶
-
class
hcrystalball.wrappers.
SarimaxWrapper
(order=None, seasonal_order=0, 0, 0, 0, start_params=None, method='lbfgs', maxiter=50, suppress_warnings=False, out_of_sample_size=0, scoring='mse', scoring_args=None, trend=None, with_intercept=True, name='sarimax', conf_int=False, init_with_autoarima=False, autoarima_dict=None, always_search_model=False, clip_predictions_lower=None, clip_predictions_upper=None)[source]¶ Bases:
hcrystalball.wrappers._base.TSModelWrapper
Wrapper for
pmdarima.arima.ARIMA
andpmdarima.arima.AutoARIMA
Search for optimal order of SARIMAX type model or instantiate one in case you provide specific order.
- Parameters
name (str) – Name of the model instance, used also as column name for returned prediction.
conf_int (bool) – Whether confidence intervals should be also outputed.
init_with_autoarima (bool) – Whether you want to leverage automated search of pmdarima.arima.AutoARIMA.
autoarima_dict (dict) – If
init_with_autoarima
is set to True, thenautoarima_dict
is used for instantiation of pmdarima.arima.AutoARIMA class, thus it serves as configuration of AutoARIMA search.always_search_model (bool) – If
init_with_autoarima
is set to True andalways_search_model
is set to True, then the optimal model will be searched for during eachfit
call. On the other hand in most cases the desired behaviour is to search for optimal model just for firstfit
call and reused this already found model on subsequentfit
calls (i.e. during cross validation).clip_predictions_lower (float) – Minimal value allowed for predictions - predictions will be clipped to this value.
clip_predictions_upper (float) – Maximum value allowed for predictions - predictions will be clipped to this value.
Methods Summary
fit
(X, y)Transform input data to
pmdarima.arima.ARIMA
required format and fit the model.get_params
([deep])Get parameters for this estimator.
predict
(X)Transform data to required format and provide predictions.
set_params
(**params)Set the parameters of this estimator.
Methods Documentation
-
fit
(X, y)[source]¶ Transform input data to
pmdarima.arima.ARIMA
required format and fit the model.- Parameters
X (pandas.DataFrame) – Input features.
y (array_like, (1d)) – Target vector.
- Returns
- Return type
self
-
get_params
(deep=True)¶ Get parameters for this estimator.
- Parameters
deep (bool, default=True) – If True, will return the parameters for this estimator and contained subobjects that are estimators.
- Returns
params – Parameter names mapped to their values.
- Return type
mapping of string to any
-
predict
(X)[source]¶ Transform data to required format and provide predictions.
- Parameters
X (pandas.DataFrame) – Input features.
- Returns
Prediction is stored in column with name being the
name
of the wrapper. Ifconf_int
attribute is set to True, the returned DataFrame will have three columns, with the second and third (named ‘name’_lower and ‘name’_upper).- Return type
-
set_params
(**params)¶ Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form
<component>__<parameter>
so that it’s possible to update each component of a nested object.