Skip to main content

Time series forecasting suite using deep learning models

Project description

Nixtla   Tweet  Slack

Neural 🧠 Forecast

User friendly state-of-the-art neural forecasting models.

CI Python PyPi conda-nixtla License docs

NeuralForecast offers a large collection of neural forecasting models focused on their usability, and robustness. The models range from classic networks like MLP, RNNs to novel proven contributions like NBEATS, TFT and other architectures.

💻 Installation

PyPI

You can install NeuralForecast's released version from the Python package index pip with:

pip install neuralforecast

(Installing inside a python virtualenvironment or a conda environment is recommended.)

Conda

Also you can install NeuralForecast's released version from conda with:

conda install -c conda-forge neuralforecast

(Installing inside a python virtual environment or a conda environment is recommended.)

Dev Mode If you want to make some modifications to the code and see the effects in real time (without reinstalling), follow the steps below:
git clone https://github.com/Nixtla/neuralforecast.git
cd neuralforecast
pip install -e .

🏃🏻‍♀️🏃 Getting Started

To get started follow this guide, where we explore NBEATS, extend it towards probabilistic predictions and exogenous variables.

Or follow this simple example where we train the NBEATS model and predict the classic Box-Jenkins air passengers dataset.

import pandas as pd
import matplotlib.pyplot as plt

from neuralforecast.utils import AirPassengersDF as Y_df
from neuralforecast.tsdataset import TimeSeriesDataset, TimeSeriesLoader

# Split data and declare panel dataset
Y_train_df = Y_df[Y_df.ds<='1959-12-31'] # 132 train
Y_test_df = Y_df[Y_df.ds>'1959-12-31']   # 12 test

# Fit and predict with N-BEATS model
nforecast = NeuralForecast(models=[NBEATS(input_size=24, h=12)])
y_hat  = nforecast.fit(df=Y_train_df).predict()

Y_test_df['N-BEATS'] = y_hat['N-BEATS'].values
pd.concat([Y_train_df, Y_test_df]).drop('unique_id', axis=1).set_index('ds').plot()

🎉 New!

  • Open In Colab Multi Quantile NBEATS Example: Produce accurate and efficient probabilistic forecasts in long-horizon settings. Outperforming AutoARIMA's accuracy in a fraction of the time.
  • Open In Colab Long Horizon N-HiTS Example: Load, train, and tune hyperparameters, to achieve SoTA. Outperform Award Winning Transformers by 25% in 50x less time.

🔥 Highlights

  • Unified StatsForecast interface NeuralForecast().fit(Y_df).predict(h=7).
  • Industry/Competition proven ESRNN, NBEATS, and TFT implementations.
  • Improve accuracy and speed over classic ARIMA/ETS in two lines of code. Check the experiments here.
  • Predict Series with little to no history, using Transfer learning. Check the experiments here.

🎊 Features

  • Exogenous Variables: Static, lagged and future exogenous support for models like TFT, NBEATSx and ESRNN.
  • Forecast Interpretability: Plot trend, seasonality and exogenous NBEATS, NHITS, ESRNN prediction components.
  • Probabilistic Forecasting: Simple model adapters for quantile losses and parametric distributions.
  • Train and Evaluation Losses Scale-dependent, percentage and scale independent errors, and parametric likelihoods.
  • Automatic Model Selection Parallelized automatic hyperparameter tuning, that efficiently searches best validation configuration.
  • Simple Interface Unified SKLearn Interface for StatsForecast and MLForecast compatibility.
  • Model Collection: Out of the box implementation of MLP, LSTM, RNN, DilatedRNN, NBEATS, NHITS, ESRNN, AutoFormer, Informer, TFT, AutoFormer, Informer, and vanilla Transformer. See the entire collection here.

Missing something? Please open an issue or write us in Slack

📖 Why?

There is a shared belief in Neural forecasting methods' capacity to improve our 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.

🔬 Accuracy & ⏲ Speed

Industry/Competition Proven Methods

An extensive empirical evaluation is critical to generate confidence and promote the adoption and development of novel methods. For this reason, we replicate and verify the results of our implementation of the following industry/competition-proven methods: ESRNN, NBEATS, NHITS, and TFT. If you are interested in reproducing the results, check the experiments here.

Simple and Efficient Method's Comparison

Like core.StatsForecast, the core.NeuralForecast wrapper class allows us to easily compare any model in the collection to select or ensemble the best performing methods. Aditionally it offers a high-end interface that operates with (potentially large) sets of time series data stored in pandas DataFrames. The core.NeuralForecast efficiently parallelizes computation across CPU or GPU resources. Check the experiments here.

📖 Documentation (WIP)

The documentation page contains the models' code documentation, methods, utils, and other tutorials. Docstrings accompany most code.

🔨 How to contribute

If you wish to contribute to the project, please refer to our contribution guidelines.

📚 References

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.

Contributors ✨

Thanks goes to these wonderful people (emoji key):


fede

💻 🐛 📖

Greg DeVos

🤔

Cristian Challu

💻

mergenthaler

📖 💻

Kin

💻 🐛 🔣

José Morales

💻

Alejandro

💻

stefanialvs

🎨

Ikko Ashimine

🐛

vglaucus

🐛

Pietro Monticone

🐛

This project follows the all-contributors specification. Contributions of any kind welcome!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

neuralforecast-1.0.0.tar.gz (51.9 kB view hashes)

Uploaded Source

Built Distribution

neuralforecast-1.0.0-py3-none-any.whl (62.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page