Selecting the Hyperparameters#

NeuralProphet has a number of hyperparameters that need to be specified by the user. If not specified, default values for these hyperparameters will be used. View the NeuralProphet class in the API documentation of for details on all hyperparameters.

Forecast horizon#

n_forecasts is the size of the forecast horizon. The default value of 1 means that the model forecasts one step into the future.


n_lags defines whether the AR-Net is enabled (if n_lags > 0) or not. The value for n_lags is usually recommended to be greater than n_forecasts, if possible since it is preferable for the FFNNs to encounter at least n_forecasts length of the past in order to predict n_forecasts into the future. Thus, n_lags determine how far into the past the auto-regressive dependencies should be considered. This could be a value chosen based on either domain expertise or an empirical analysis.

Increasing Depth of the Model#

num_hidden_layers defines the number of hidden layers of the FFNNs used in the overall model. This includes the AR-Net and the FFNN of the lagged regressors. The default is 0, meaning that the FFNNs will have only one final layer of size n_forecasts. Adding more layers results in increased complexity and also increased computational time, consequently. However, the added number of hidden layers can help build more complex relationships especially useful for the lagged regressors. To tradeoff between the computational complexity and the improved accuracy the num_hidden_layers is recommended to be set in between 1-2. Nevertheless, in most cases a good enough performance can be achieved by having no hidden layers at all.

d_hidden is the number of units in the hidden layers. This is only considered if num_hidden_layers is specified, otherwise ignored. The default value for d_hidden if not specified is (n_lags + n_forecasts). If tuned manually, the recommended practice is to set a value in between n_lags and n_forecasts for d_hidden. It is also important to note that with the current implementation, NeuralProphet sets the same d_hidden for the all the hidden layers.