models.NBEATS and models.RNN. The second component is a high-level core.NeuralForecast wrapper class that operates with sets of time series data stored in pandas DataFrames.
NeuralForecast
core.StatsForecast class allows you to efficiently fit multiple NeuralForecast models
for large sets of time series. It operates with a pandas DataFrame df that identifies series
and datestamps with the unique_id and ds columns. The y column denotes the target
time series variable.
Parameters:
Returns:
NeuralForecast.fit
models to a large set of time series from DataFrame df
and store fitted models for later inspection.
Parameters:
Returns:
NeuralForecast.predict
models to predict large set of time series from DataFrame df.
Predicting with a different horizon than training
The h argument can override the horizon each model was fitted with, but the allowed values depend on the model and the fit configuration:
hequal to the fitted horizon (the default whenh=None): all models produce a single forward pass of lengthh.hgreater than the fitted horizon: supported, with restrictions.- Direct (non-recurrent) models such as
NHITS,NBEATS,NBEATSx,MLP,TFT,PatchTST, and other windows-based models produce the extended horizon by feeding their own forecasts back as inputs and runningceil(h / fitted_h)recursive rollouts. Accuracy is not guaranteed beyond the fitted horizon; errors compound across rollouts. Consider refitting with the target horizon (or using an Auto model) if quality matters. - Recurrent models such as
RNN,LSTM,GRU,DilatedRNN,TCN, andDeepARextend the horizon natively by rolling the recurrent state forward. h > fitted_his not supported when the fit was calibrated withprediction_intervals(raisesValueError) or when any model declareshist_exog_list(raisesNotImplementedError).
- Direct (non-recurrent) models such as
hsmaller than the fitted horizon: not supported and raisesValueError. Refit the model with the smaller horizon, or take the firsthsteps of the default forecast yourself.
Returns:
NeuralForecast.cross_validation
core.NeuralForecast’s cross-validation efficiently fits a list of NeuralForecast
models through multiple windows, in either chained or rolled manner.
Parameters:
Returns:
NeuralForecast.predict_insample
core.NeuralForecast’s predict_insample uses stored fitted models
to predict historic values of a time series from the stored dataframe.
Parameters:
Returns:
NeuralForecast.save
core.NeuralForecast’s method to save current status of models, dataset, and configuration.
Note that by default the models are not saving training checkpoints to save disk memory,
to get them change the individual model **trainer_kwargs to include enable_checkpointing=True.
Parameters:
NeuralForecast.load
core.NeuralForecast’s method to load checkpoint from path.
Parameters:
Returns:

