User friendly state-of-the-art neural forecasting models
NeuralForecast offers a large collection of neural forecasting models focusing on their performance, usability, and robustness. The models range from classic networks like RNNs to the latest transformers: MLP, LSTM, GRU, RNN, TCN, TimesNet, BiTCN, DeepAR, , , , , , , , , , , , , , , , , , and .
There is a shared belief in Neural forecasting methods' capacity to improve forecasting pipeline's accuracy and efficiency.
Unfortunately, available implementations and published research are yet to realize neural networks' potential. They are hard to use and continuously fail to improve over statistical methods while being computationally prohibitive. For this reason, we created NeuralForecast, a library favoring proven accurate and efficient models focusing on their usability.
Features
Fast and accurate implementations of more than 30 state-of-the-art models. See the entire collection here.
Support for exogenous variables and static covariates.
Interpretability methods for trend, seasonality and exogenous components.
Probabilistic Forecasting with adapters for quantile losses and parametric distributions.
Train and Evaluation Losses with scale-dependent, percentage and scale independent errors, and parametric likelihoods.
Automatic Model Selection with distributed automatic hyperparameter tuning.
Familiar sklearn syntax: .fit and .predict.
Highlights
Official NHITS implementation, published at AAAI 2023. See paper and experiments.
Official NBEATSx implementation, published at the International Journal of Forecasting. See paper.
Unified withStatsForecast, MLForecast, and HierarchicalForecast interface NeuralForecast().fit(Y_df).predict(), inputs and outputs.
Built-in integrations with utilsforecast and coreforecast for visualization and data-wrangling efficient methods.
Integrations with Ray and Optuna for automatic hyperparameter optimization.
Predict with little to no history using Transfer learning. Check the experiments here.
Missing something? Please open an issue or write us in
From 3.3.0 a saved directory holds safetensors
weights and JSON metadata, and is loaded without executing any code it contains. Earlier versions
used pickle, which runs arbitrary code from the artifact on load, so the legacy format is now
opt-in:
nf.save('./checkpoints/') # writes the new format
nf2 = NeuralForecast.load('./checkpoints/') # no pickle, no code execution
What changed, if you have artifacts or code from an earlier version:
Older directories need consent or conversion. Pass allow_pickle=True to read one in place,
which executes code contained in it, or convert it once with
python -m neuralforecast.migrate ./old_checkpoints/. A directory saved with
save_dataset=True must be converted — its dataset has no safe reader.
Remote paths are opt-in.NeuralForecast.load('s3://bucket/models/', trust_remote=True),
because whoever can write that location chooses what runs on the loading machine.
Custom losses, optimizers and schedulers must be registered with register_loss,
register_optimizer or register_lr_scheduler, in the process that loads as well as the one
that saves.
TimeLLM can no longer be saved or loaded. It resolves its llm argument through
from_pretrained while being constructed, so an artifact could direct that fetch. Train and
predict with it in the same process.
This work is highly influenced by the fantastic work of previous contributors and other scholars on the neural forecasting methods presented here. We want to highlight the work of Boris Oreshkin, Slawek Smyl, Bryan Lim, and David Salinas. We refer to Benidis et al. for a comprehensive survey of neural forecasting methods.
🙏 How to cite
If you enjoy or benefit from using these Python implementations, a citation to the repository will be greatly appreciated.
@misc{olivares2022library_neuralforecast,
author={Kin G. Olivares and
Cristian Challú and
Azul Garza and
Max Mergenthaler Canseco and
Artur Dubrawski},
title = {{NeuralForecast}: User friendly state-of-the-art neural forecasting models.},
year={2022},
howpublished={{PyCon} Salt Lake City, Utah, US 2022},
url={https://github.com/Nixtla/neuralforecast}
}
Contributors ✨
Thanks goes to these wonderful people (emoji key):