Forecaster
PyFableARIMA
ARIMA model from the CRAN package fable.
Wraps the ARIMA model from the fable package in R, see [1] for details.
Searches through the model space specified in the specials to identify the best ARIMA model, with the lowest AIC, AICc or BIC value. It is implemented using R’s stats::arima() and allows ARIMA models to be used in the fable framework.
Schnellstart
python
from sktime.forecasting.pyfable_arima import PyFableARIMA
estimator = PyFableARIMA(formula=None, ic='aicc', selection_metric=None, stepwise=True, greedy=True, approximation=None, order_constraint=None, unitroot_spec=None, trace=False, is_regular=True, verbose=False)Parameter(10)
- formulastring, optional (default = None)
- Model specification (e.g. “y ~ z”) N.B. To specify a model fully (avoid automatic selection), the intercept and pdq()/PDQ() values must be specified. For example, formula = sales ~ 1 + pdq(1, 1, 1) + PDQ(1, 0, 0).
- icstring, optional (default = “aicc”)
- The information criterion used in selecting the model. One of “aic”, “aicc”, “bic”
- selection_metricoptional; a function
- selection_metric = function(x) x[[ic]], A function used to compute a metric from an Arima object which is minimised to select the best model.
- stepwiselogical (default = True)
- Should the stepwise search algorithm be used? Stepwise is a greedy-like algorithm that can significantly reduce the number of models tested, which can make the search much faster. If used, there is a risk of missing the global minimum.
- greedylogical (default = True)
- Should the stepwise search move to the next best option immediately?
- approximationlogical (default = None)
- Should CSS (conditional sum of squares) be used during model selection? The default (NULL) will use the approximation if there are more than 150 observations or if the seasonal period is greater than 12.
- order_constraintstring, optional
- (default = p + q + P + Q <= 6 & (constant + d + D <= 2) A logical predicate on the orders of p, d, q, P, D, Q and constant to consider in the search. See “Specials” for the meaning of these terms.
- unitroot_specoptional
- A specification of unit root tests to use in the selection of d and D. See unitroot_options() for more details
- tracelogical (default = False)
- If True, the selection_metric of estimated models in the selection procedure will be outputted to the console.
- is_regularlogical (default = True)
- Is the series regular? (i.e. are the time-steps equal throughout)
Beispiele
>>> from sktime.datasets import load_airline
>>> from sktime.forecasting.PyFableARIMA import PyFableARIMA
>>> from sktime.forecasting.model_selection import (
... temporal_train_test_split,
... )
>>> airline = load_airline () # Series with PeriodIndex freq='M'
>>> airline. name = "Passengers" # name must match ARIMA formula
>>> train, test = temporal_train_test_split (airline, test_size = 12)
>>> best = PyFableARIMA (formula = 'Passengers'). fit (train)
>>> print (best. report ())
>>> fitted = best. predict (train. index)
>>> print (f "fitted = \n { fitted } ")
>>> pred = best. predict (test. index)
>>> print (f "pred = \n { pred } ")
>>> pred_int = best. predict_interval (
... fh = test. index, coverage = [0.95, 0.50 ]
... )
>>> print (f "pred_int = \n { pred_int } ")