View source: R/parsnip-neuralprophet.R
Bridge Prophet-Catboost Modeling function
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | neural_prophet_fit_impl(
formula,
data,
growth = "linear",
changepoints = NULL,
n_changepoints = 5L,
changepoints_range = 0.8,
yearly_seasonality = "auto",
weekly_seasonality = "auto",
daily_seasonality = "auto",
seasonality_mode = "additive",
trend_reg = 0L,
trend_reg_threshold = FALSE,
seasonality_reg = 0L,
n_forecasts = 1L,
n_lags = 0L,
= 0L,
= NULL,
ar_sparsity = NULL,
learning_rate = NULL,
epochs = NULL,
batch_size = NULL,
loss_func = "Huber",
train_speed = NULL,
normalize_y = "auto",
impute_missing = TRUE,
freq = NULL,
...
)
|
formula |
Value |
data |
Value |
growth |
String 'linear' or 'logistic' to specify a linear or logistic trend. |
changepoints |
changepoints |
n_changepoints |
n_changepoints |
changepoints_range |
changepoints_range |
yearly_seasonality |
yearly_seasonality |
weekly_seasonality |
weekly_seasonality |
daily_seasonality |
daily_seasonality |
seasonality_mode |
The default seasonality_mode is additive. This means that no heteroscedasticity is expected in the series in terms of the seasonality. However, if the series contains clear variance, where the seasonal fluctuations become larger proportional to the trend, the seasonality_mode can be set to multiplicative. |
trend_reg |
the trend rate changes can be regularized by setting trend_reg to a value greater zero. This is a useful feature that can be used to automatically detect relevant changepoints. |
trend_reg_threshold |
Threshold for the trend regularization |
seasonality_reg |
seasonality_reg |
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. |
num_hidden_layers |
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 |
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. |
ar_sparsity |
NeuralProphet also contains a number of regularization parameters to control the model coefficients and introduce sparsity into the model. This also helps avoid overfitting of the model to the training data.For ar_sparsity values in the range 0-1 are expected with 0 inducing complete sparsity and 1 imposing no regularization at all. ar_sparsity along with n_lags can be used for data exploration and feature selection. You can use a larger number of lags thanks to the scalability of AR-Net and use the scarcity to identify important influence of past time steps on the prediction accuracy. |
learning_rate |
learning_rate |
epochs |
The epochs and the loss_func are two other parameters that directly affect the model training process. If not defined, both are automatically set based on the dataset size. They are set in a manner that controls the total number training steps to be around 1000 to 4000. |
batch_size |
number of samples that will be propagated through the network |
loss_func |
The default loss function is the 'Huber' loss, which is considered to be robust to outliers. However, you are free to choose the standard MSE or any other PyTorch torch.nn.modules.loss loss function. |
train_speed |
Number indicating the speed at which training of the network occurs. |
normalize_y |
is about scaling the time series before modelling. By default, NeuralProphet performs a (soft) min-max normalization of the time series. Normalization can help the model training process if the series values fluctuate heavily. However, if the series does not such scaling, users can turn this off or select another normalization. |
impute_missing |
is about imputing the missing values in a given series. S imilar to Prophet, NeuralProphet too can work with missing values when it is in the regression mode without the AR-Net. However, when the autocorrelation needs to be captured, it is necessary for the missing values to be imputed, since then the modelling becomes an ordered problem. Letting this parameter at its default can get the job done perfectly in most cases. |
freq |
A pandas timeseries frequency such as "5min" for 5-minutes or "D" for daily. Refer to Pandas Offset Aliases |
... |
Additional arguments |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.