AR-Net can be enabled in the NeuralProphet by simply setting an appropriate value to the
n_lags parameter of the
m = NeuralProphet( n_forecasts=3, n_lags=5, yearly_seasonality=False, weekly_seasonality=False, daily_seasonality=False, )
In the above example, we create a forecasting scenario which feeds 5 lags into AR-Net and receives
3 steps as forecasts. Once you have the AR-Net enabled, during forecasting your
should be equal to the
n_forecasts value specified when creating the
NeuralProphet object. Whichever
value you specify for
future_periods, it will be converted to the value of
n_forecasts with a notice
to the user. This is because, since the AR-Net is built during training such that it has an ouptut size
n_forecasts, it cannot support any other value during testing.
The plotted components should look like below.
You can now see auto-regression as a separate component. The corresponding coefficients look like below.
You can see the relevance of each of the lags when modelling the autocorrelation. You can also specify the
for the AR-Net, in order to increase the complexity of the AR-Net.
m = NeuralProphet( n_forecasts=3, n_lags=5, num_hidden_layers=2, yearly_seasonality=False, weekly_seasonality=False, daily_seasonality=False )
Regularization in AR-Net is done by setting the
ar_sparsity parameter in the
like below. For more details on setting a value for
ar_sparsity, refer to the Section on
m = NeuralProphet( n_forecasts=3, n_lags=5, num_hidden_layers=2, ar_sparsity=0.01, yearly_seasonality=False, weekly_seasonality=False, daily_seasonality=False )
Highlight Specific Forecast Step
When modelling the autocorrelation, the model in the multi-input, multi-output mode. In this mode, you can highlight the nth step ahead forecast. This means that, you can specifically look at the forecast at the nth step when calculating errors during model training as well as when forecast plotting. This can be done like below.
m = NeuralProphet( n_forecasts=30, n_lags=60, yearly_seasonality=False, weekly_seasonality=False, daily_seasonality=False ) m.highlight_nth_step_ahead_of_each_forecast(step_number=m.n_forecasts)
You can specify any value less than or equal to
n_forecasts to the
Once you do this, the metrics would look like below.
In the forecast plots, it will focus only on the nth step ahead forecast. This is shown below for the fir of the model.