Top Related Projects
Tool for producing high quality forecasts for time series data that has multiple seasonality with linear or non-linear growth.
A Python package for Bayesian forecasting with object-oriented design and probabilistic models under the hood.
A flexible, intuitive and fast forecasting library
A unified framework for machine learning with time series
Scalable and user friendly neural :brain: forecasting algorithms.
Quick Overview
NeuralProphet is an open-source Python library for time series forecasting that combines traditional statistical models with neural network components. It extends Facebook's Prophet model by incorporating deep learning techniques, allowing for more flexible and powerful forecasting capabilities while maintaining interpretability.
Pros
- Combines the interpretability of traditional forecasting methods with the power of neural networks
- Supports automatic seasonality detection and handling of multiple seasonalities
- Allows for the incorporation of external regressors and events
- Provides built-in cross-validation and hyperparameter tuning capabilities
Cons
- May require more computational resources compared to simpler forecasting methods
- Learning curve can be steeper for users not familiar with both statistical and deep learning concepts
- Documentation, while improving, may not be as comprehensive as more established libraries
- Limited support for certain advanced features found in some other forecasting libraries
Code Examples
- Basic forecasting:
from neuralprophet import NeuralProphet
import pandas as pd
# Load data
df = pd.read_csv('your_data.csv')
# Create and fit the model
m = NeuralProphet()
metrics = m.fit(df, freq='D')
# Make future predictions
future = m.make_future_dataframe(df, periods=30)
forecast = m.predict(future)
- Adding seasonality and holidays:
from neuralprophet import NeuralProphet
m = NeuralProphet(
yearly_seasonality=True,
weekly_seasonality=True,
daily_seasonality=False,
seasonality_mode='multiplicative',
country_holidays='US'
)
metrics = m.fit(df, freq='D')
- Incorporating external regressors:
from neuralprophet import NeuralProphet
m = NeuralProphet()
m = m.add_lagged_regressor(name='temperature')
m = m.add_future_regressor(name='price')
metrics = m.fit(df, freq='D')
Getting Started
To get started with NeuralProphet:
- Install the library:
pip install neuralprophet
- Import and use in your Python script:
from neuralprophet import NeuralProphet
import pandas as pd
# Load your time series data
df = pd.read_csv('your_data.csv', parse_dates=['ds'])
# Create and fit the model
m = NeuralProphet()
metrics = m.fit(df, freq='D')
# Make predictions
future = m.make_future_dataframe(df, periods=30)
forecast = m.predict(future)
# Plot the forecast
fig_forecast = m.plot(forecast)
This basic example demonstrates how to load data, fit a model, make predictions, and visualize the results using NeuralProphet.
Competitor Comparisons
Tool for producing high quality forecasts for time series data that has multiple seasonality with linear or non-linear growth.
Pros of Prophet
- More established and widely adopted in industry
- Extensive documentation and community support
- Handles seasonality and holidays out-of-the-box
Cons of Prophet
- Less flexible for custom model architectures
- May struggle with complex, non-linear patterns
- Limited ability to incorporate external regressors
Code Comparison
Prophet:
from fbprophet import Prophet
model = Prophet()
model.fit(df)
future = model.make_future_dataframe(periods=365)
forecast = model.predict(future)
Neural Prophet:
from neuralprophet import NeuralProphet
model = NeuralProphet()
model.fit(df, freq="D")
future = model.make_future_dataframe(df, periods=365)
forecast = model.predict(future)
Both libraries offer similar high-level APIs for time series forecasting. However, Neural Prophet provides more flexibility in model architecture and allows for easier integration of external regressors. Prophet, on the other hand, offers simpler out-of-the-box functionality for handling seasonality and holidays.
Neural Prophet builds upon Prophet's concepts while leveraging PyTorch for neural network-based forecasting. This approach enables it to capture more complex patterns and non-linear relationships in the data. However, Prophet remains a solid choice for simpler forecasting tasks and benefits from its mature ecosystem and extensive documentation.
A Python package for Bayesian forecasting with object-oriented design and probabilistic models under the hood.
Pros of Orbit
- More flexible modeling approach, supporting various time series patterns
- Better handling of multiple seasonalities and complex trends
- Robust uncertainty quantification through Bayesian inference
Cons of Orbit
- Steeper learning curve due to more complex API
- Slower training and inference times compared to Neural Prophet
- Less focus on interpretability of model components
Code Comparison
Neural Prophet:
from neuralprophet import NeuralProphet
m = NeuralProphet()
m.fit(df)
future = m.make_future_dataframe(df, periods=30)
forecast = m.predict(future)
Orbit:
from orbit.models import DLT
model = DLT(response_col='y', date_col='ds', seasonality=[52])
model.fit(df)
predicted = model.predict(df)
Summary
Both Neural Prophet and Orbit are powerful time series forecasting libraries, but they cater to different use cases. Neural Prophet offers a more user-friendly interface and faster performance, making it suitable for quick prototyping and simpler forecasting tasks. Orbit, on the other hand, provides more flexibility and advanced modeling capabilities, making it ideal for complex time series problems that require fine-grained control over model components and uncertainty estimation.
A flexible, intuitive and fast forecasting library
Pros of Greykite
- More comprehensive forecasting toolkit with multiple models and algorithms
- Offers advanced features like automatic model selection and hyperparameter tuning
- Provides extensive documentation and tutorials for ease of use
Cons of Greykite
- Steeper learning curve due to its more complex architecture
- May be overkill for simpler forecasting tasks
- Less focus on neural network-based approaches compared to NeuralProphet
Code Comparison
NeuralProphet:
from neuralprophet import NeuralProphet
m = NeuralProphet()
metrics = m.fit(df)
future = m.make_future_dataframe(df, periods=30)
forecast = m.predict(future)
Greykite:
from greykite.framework.templates.autogen.forecast_config import ForecastConfig
from greykite.framework.templates.forecaster import Forecaster
config = ForecastConfig(model_template="SILVERKITE")
forecaster = Forecaster()
result = forecaster.run_forecast_config(df, config)
Both libraries offer straightforward APIs for time series forecasting, but Greykite provides more configuration options and flexibility in model selection. NeuralProphet focuses on neural network-based forecasting, while Greykite offers a broader range of traditional and advanced forecasting techniques.
A unified framework for machine learning with time series
Pros of sktime
- Broader scope: Supports various time series tasks beyond forecasting, including classification and clustering
- Extensive algorithm collection: Offers a wide range of time series algorithms and models
- Scikit-learn compatible: Integrates well with the scikit-learn ecosystem
Cons of sktime
- Steeper learning curve: More complex API due to its broader scope
- Less specialized for forecasting: May not have as many forecasting-specific features as Neural Prophet
Code Comparison
sktime:
from sktime.forecasting.arima import ARIMA
from sktime.datasets import load_airline
y = load_airline()
forecaster = ARIMA(order=(1, 1, 1), seasonal_order=(1, 1, 1, 12))
forecaster.fit(y)
y_pred = forecaster.predict(fh=[1, 2, 3])
Neural Prophet:
from neuralprophet import NeuralProphet
import pandas as pd
df = pd.read_csv('your_data.csv')
m = NeuralProphet()
metrics = m.fit(df, freq="D")
future = m.make_future_dataframe(df, periods=30)
forecast = m.predict(future)
Scalable and user friendly neural :brain: forecasting algorithms.
Pros of neuralforecast
- Supports a wider range of neural forecasting models, including N-BEATS, DeepAR, and TFT
- Offers more advanced features like probabilistic forecasting and hierarchical reconciliation
- Provides better integration with popular data science libraries like pandas and scikit-learn
Cons of neuralforecast
- Steeper learning curve due to more complex API and advanced features
- May require more computational resources for training and inference
- Less focused on interpretability compared to neural_prophet
Code Comparison
neural_prophet:
from neuralprophet import NeuralProphet
m = NeuralProphet()
m.fit(df)
future = m.make_future_dataframe(periods=30)
forecast = m.predict(future)
neuralforecast:
from neuralforecast import NeuralForecast
from neuralforecast.models import NBEATS
model = NeuralForecast(models=[NBEATS(input_size=7, h=1)])
model.fit(df)
forecast = model.predict()
Both libraries offer user-friendly APIs for time series forecasting, but neuralforecast provides more flexibility and advanced features at the cost of increased complexity. neural_prophet focuses on simplicity and interpretability, making it easier for beginners to get started with neural forecasting.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Please note that the project is still in beta phase. Please report any issues you encounter or suggestions you have. We will do our best to address them quickly. Contributions are very welcome!
NeuralProphet: human-centered forecasting
NeuralProphet is an easy to learn framework for interpretable time series forecasting. NeuralProphet is built on PyTorch and combines Neural Networks and traditional time-series algorithms, inspired by Facebook Prophet and AR-Net.
- With a few lines of code, you can define, customize, visualize, and evaluate your own forecasting models.
- It is designed for iterative human-in-the-loop model building. That means that you can build a first model quickly, interpret the results, improve, repeat. Due to the focus on interpretability and customization-ability, NeuralProphet may not be the most accurate model out-of-the-box; so, don't hesitate to adjust and iterate until you like your results.
- NeuralProphet is best suited for time series data that is of higher-frequency (sub-daily) and longer duration (at least two full periods/years).
Documentation
The documentation page may not be entirely up to date. Docstrings should be reliable, please refer to those when in doubt. We are working on an improved documentation. We appreciate any help to improve and update the docs.
For a visual introduction to NeuralProphet, view this presentation.
Contribute
We compiled a Contributing to NeuralProphet page with practical instructions and further resources to help you become part of the family.
Community
Discussion and Help
If you have any questions or suggestion, you can participate in our community right here on Github
Slack Chat
We also have an active Slack community. Come and join the conversation!
Tutorials
There are several example notebooks to help you get started.
You can find the datasets used in the tutorials, including data preprocessing examples, in our neuralprophet-data repository.
Please refer to our documentation page for more resources.
Minimal example
from neuralprophet import NeuralProphet
After importing the package, you can use NeuralProphet in your code:
m = NeuralProphet()
metrics = m.fit(df)
forecast = m.predict(df)
You can visualize your results with the inbuilt plotting functions:
fig_forecast = m.plot(forecast)
fig_components = m.plot_components(forecast)
fig_model = m.plot_parameters()
If you want to forecast into the unknown future, extend the dataframe before predicting:
m = NeuralProphet().fit(df, freq="D")
df_future = m.make_future_dataframe(df, periods=30)
forecast = m.predict(df_future)
fig_forecast = m.plot(forecast)
Install
You can now install neuralprophet directly with pip:
pip install neuralprophet
Install options
If you plan to use the package in a Jupyter notebook, we recommended to install the 'live' version:
pip install neuralprophet[live]
This will allow you to enable plot_live_loss
in the fit
function to get a live plot of train (and validation) loss.
If you would like the most up to date version, you can instead install directly from github:
git clone <copied link from github>
cd neural_prophet
pip install .
Note for Windows users: Please use WSL2.
Features
Model components
- Autoregression: Autocorrelation modelling - linear or NN (AR-Net).
- Trend: Piecewise linear trend with optional automatic changepoint detection.
- Seasonality: Fourier terms at different periods such as yearly, daily, weekly, hourly.
- Lagged regressors: Lagged observations (e.g temperature sensor) - linear or NN.
- Future regressors: In advance known features (e.g. temperature forecast) - linear or NN.
- Events: Country holidays & recurring custom events.
- Global Modeling: Components can be local, global or 'glocal' (global + regularized local)
Framework features
- Multiple time series: Fit a global/glocal model with (partially) shared model parameters.
- Uncertainty: Estimate values of specific quantiles - Quantile Regression.
- Regularize modelling components.
- Plotting of forecast components, model coefficients and more.
- Time series crossvalidation utility.
- Model checkpointing and validation.
Coming soon:tm:
- Cross-relation of lagged regressors.
- Static metadata regression for multiple series
- Logistic growth for trend component.
For a list of past changes, please refer to the releases page.
Cite
Please cite NeuralProphet in your publications if it helps your research:
@misc{triebe2021neuralprophet,
title={NeuralProphet: Explainable Forecasting at Scale},
author={Oskar Triebe and Hansika Hewamalage and Polina Pilyugina and Nikolay Laptev and Christoph Bergmeir and Ram Rajagopal},
year={2021},
eprint={2111.15397},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
Many Thanks To Our Contributors:
About
NeuralProphet is an open-source community project, supported by awesome people like you. If you are interested in joining the project, please feel free to reach out to me (Oskar) - you can find my email on the NeuralProphet Paper.
Top Related Projects
Tool for producing high quality forecasts for time series data that has multiple seasonality with linear or non-linear growth.
A Python package for Bayesian forecasting with object-oriented design and probabilistic models under the hood.
A flexible, intuitive and fast forecasting library
A unified framework for machine learning with time series
Scalable and user friendly neural :brain: forecasting algorithms.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot