This workflow predicts the irregular component of time series (energy consumption) by autoregressive integrated moving average (ARIMA) models that aim at modeling the correlation between lagged values and controling for seasonality in time series. The number of lagged values considered in the model can be set manually, or it can be optimized by testing different combinations of AR, I, and MA components of the model. The irregular component of time series is what is left after removing the trend and first and second seasonality.
This is a companion discussion topic for the original entry at https://kni.me/w/BeonYYvvrckaTbDQ
Hi Corey and Maarit,
I wanted to let you know that there are a few time series components that are giving errors. These include the ARIMA Learner, the Auto-sARIMA Learner, and the Auto-ARIMA Learner.
I documented my findings in this post: ARIMA Learner Component Gives Deprecated Package Error
As best I can tell, it may be due to some deprecated Python libraries.
Thanks for the heads up @Haystack
I think something must have just changed with the Statsmodels python package, I’m looking into a fix.
In the mean time please use the SARIMA components instead - they are newer and use a more up to date version of statsmodels. They have all the same functionality as the ARIMA components with the additional option to include seasonal terms.
Learner: SARIMA Learner – KNIME Hub
Predictor: SARIMA Predictor – KNIME Hub
Auto-SARIMA: Auto-SARIMA – KNIME Hub
Blog post on the SARIMA: S.A.R.I.M.A. Seasonal ARIMA Models with KNIME | KNIME
Thank you, @Corey!
I also noticed that the Auto-SARIMA is giving an error:
So is Analyze ARIMA Residuals:
Thank you for suggesting the SARIMA Learner node.
I have another question:
I noticed that the PMML Writer node does not connect to any of the ARIMA nodes. How can we use our trained model to forecast future values on new data?
Also, I took a look at the Python Learner errors in the scripts and they refer to the ‘i_out’, ‘j_out’, and ‘k_out’ variables not being defined earlier in the script. I defined them using i_out = 0, but got another error: output_model is not defined.
Lastly, none of the examples on the Hub show how to predict future values (using the predict() function on the [ARIMAResults] object to make predictions. Since the existing examples use the broken components, I cannot see how this is done (for example referencing this workflow: Accessing, Transforming and Modeling Time Series – KNIME Hub).
Can you please point me to some examples that show predictions on future values vs. just the training set? Or, if there are none, what can be done with the Python Leaner script to get the components working again?
Many thanks for any help you can provide.
Hi @Haystack, good questions:
About saving the model
The (S)ARIMA model is not pmml compatible, unfortunately few model types are. However you can save any model type with the Model Writer node and equivalently read them back into KNIME with the Model Reader node. Alternatively you can write the model out with the Python Object Writer node, just be careful that you import it into a compatible python environment.
About forecasting with the model
To generate forecasts use the SARIMA Predictor component, you’ll find it on the example sever right next to the learner. I’m not sure what the workflow you linked is but here is a nice example of how to use these components:
About using the model on new data
Forecasting models typically don’t consume input data when they generate forecasts, so there’s really no concept of applying the model to new data.
I typically do not save the trained models for this reason, my pipeline looks like this:
- Explore data, determine best model type and parameters
- Train model on partitioned data, score model to understand performance
- Train model on entire dataset (or on relevant recent portion of the dataset)
- Generate forecast
- retrain model as new data comes in
- generate new forecasts
- repeat steps 5 & 6
Thanks for exploring those python errors - I’ll do some investigating there.
are there any updates to the Python Errors on your side?
Thanks a lot, any help is much appreciated!