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, hcb_verbose=True)[source]¶
Bases:
hcrystalball.wrappers._base.TSModelWrapper
Wrapper for
ARIMA
andAutoARIMA
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 ofAutoARIMA
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.
hcb_verbose (bool) – Whtether to keep (True) or suppress (False) messages to stdout and stderr from the wrapper and 3rd party libraries during fit and predict
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.
- 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
Pipeline
). The latter have parameters of the form<component>__<parameter>
so that it’s possible to update each component of a nested object.- Parameters
**params (dict) – Estimator parameters.
- Returns
self – Estimator instance.
- Return type
estimator instance