Closed JuanFT closed 5 years ago
First of all, we don't define a forecast
method, so I'm not sure where that expectation came from... second, it looks like you are mixing up statsmodels code and our package. There are a lot of errors and inconsistencies in your code:
fit
your auto-arima model as it's already been fit:model_def = auto_arima(dataImport_sel1, start_p=1, start_q=1,
max_p=3, max_q=3, m=12,
start_P=0, seasonal=True,
d=1, D=1, trace=True,
error_action='ignore',
suppress_warnings=True,
stepwise=True)
model_fit_def = model_def.fit(train) # you don't need to do this.
forecast
method, this would break, as you're trying to unpack a tuple after indexing out the first element:forecast_def,stderr_def,conf_int_def = model_fit_def.forecast()[0]
I think you're looking at statsmodels examples and trying to use pmdarima, which isn't going to work. Check out our examples of use and the API documentation for the ARIMA class.
Namely, we try to be scikit-learn-esque. Meaning predict
for inference, fit
for train. To get in-sample predictions, you'd use predict_in_sample
.
Thank you Taylor, that is very useful information. However, I'm still struggling to understand why the fit is not necessary, as you said, "it's already been fit".
My goal is to create a model (i) prove that it is accurate splitting data between train and test, (ii) forecast future values (iii) when I get new values, compare the forecast with the new values and (iv) show if it is within the confidence interval.
Any guideline will be much appreciated. Thank you!
Because the auto arima function calls fit
internally. The examples you show that explicitly call it were either calling it directly on the ARIMA
object or on the pipeline. Feel free to dig through the source to grok it better. pmdarima/arima/auto.py
Description
I have created a function with the Auto Arima together with the model fit and the forecast (predict??). It works ok, but when I put it in the for loop it shows up this error. I tried also changing to model.fit(disp=0), instead of model.fit(train), but it shows a different error "fit() missing 1 required argument 'y'. AttributeError: 'ARIMA' object has no attribute 'forecast'
Steps/Code to Reproduce
13 forecast_def,stderr_def=AutoARIMAForecasting(history) 14 print('Actual=%f, Predicted=%f' % (obs, forecast_def)) 15 predictions.append(forecast_def)