Multi Prophet
Multi Prophet is a procedure for forecasting time series data for multipe dependent variables based on Facebook Prophet package. If you have no prior experience with Facebook Prophet, check out their docs.
Multi Prophet does not train a single model with many outputs, it just wraps Facebook Prophet interface to support configuration and controll over multiple models. Multi Prophet has a very similar interface as Facebook Prophet.
The main difference is that return values of each method is a dictionary where each dependent value is a key, and the value is the return value of the linked Facebook Prophet model.
If Prophet return value is a data frame, then MultiProphet return value will be:
{"dependent_variable1": df1, "dependent_variable2": df2}
Installation
Multi Prophet is on PyPi.
pip install multi-prophet
Getting started
Creating a basic model is almost the same as creating a Prophet model:
Prophet
# dataframe needs to have columns ds and y
from fbprophet import Prophet
m = Prophet()
m.fit(df)
future = m.create_future_dataframe(df)
forecast = m.predict(future)
m.plot(forecast)
Multi Prophet
# dataframe needs to have column ds, and it has y1 and y2 as dependent variables
from multi_prophet import MultiProphet
m = MultiProphet(columns=["y1", "y2"])
m.fit(df)
future = m.create_future_dataframe(df)
forecast = m.predict(future)
m.plot(forecast)
Adding country holidays
Prophet
m.add_country_holidays(country_name="US")
Multi Prophet
# For all dependent variables
m.add_country_holidays("US")
# For selected dependent variables
m.add_country_holidays("US", columns=["y1"])
Adding seasonality
Prophet
m.add_seasonality(name="monthly", period=30.5, fourier_order=5)
Multi Prophet
# For all dependent variables
m.add_seasonality(name="monthly", period=30.5, fourier_order=5)
# For selected dependent variables
m.add_seasonality(name="monthly", period=30.5, fourier_order=5, columns=["y1"])
Adding regressors
Prophet
m.add_regressor("Matchday")
Multi Prophet
# For all dependent variables
m.add_regressor("Matchday")
# For selected dependent variables
m.add_regressor("Matchday", columns=["y"])
Ploting results
Prophet
# Prophet
m.plot(forecast)
m.plot_components(forecast)
# With Plotly
from fbprophet.plot import plot_plotly, plot_components_plotly
import plotly.offline as py
py.init_notebook_mode()
fig = plot_plotly(m, forecast)
py.iplot(fig)
fig = plot_components_plotly(m, forecast)
py.iplot(fig)
Multi Prophet
m.plot(forecast)
m.plot_components(forecast)
# With Plotly
figures = m.plot(forecast, plotly=True)
for fig in figures.values():
fig.show()
# or access by key
figures["y1"].show()
figures = m.plot_components(forecast, plotly=True)
for fig in figures.values():
fig.show()
# or access by key
figures["y1"].show()
Facebook Prophet model configuration
Facebook Prophet supports a lot of configuration through kwargs. There are two ways to do it with Multi Prophet:
- Through kwargs just as with Facebook Prophet
- Prophet
m = Prophet(growth="logistic")
m.fit(self.df, algorithm="Newton")
m.make_future_dataframe(7, freq="H")
m.add_regressor("Matchday", prior_scale=10)
* Multi Prophet
m = MultiProphet(columns=["y1", "y2"], growth="logistic")
m.fit(self.df, algorithm="Newton")
m.make_future_dataframe(7, freq="H")
m.add_regressor("Matchday", prior_scale=10)
- Configuration through constructor
# Same configuration for each dependent variable
m = MultiProphet(columns=["y1", "y2"],
growth="logistic",
weekly_seasonality=True,
n_changepoints=50)
# Different configuration for each model
config = {
"y1": {"growth": "linear", "daily_seasonality": True},
"y2": {"growth": "logistic", "weekly_seasonality": True}
}
m = MultiProphet(columns=["y1", "y2"], config=config)
# Adding regressors (dataframe has columns c1 and c2)
regressors = {
"y1": [
{"name": "c1", "prior_scale": 0.5},
{ "name": "c2", "prior_scale": 0.3}
],
"y2": [{"name": "c2", "prior_scale": 0.3}]
}
m = MultiProphet(columns=["y1", "y2"], regressors=regressors)
Metadata
Release files for multi-prophet 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| multi-prophet-1.1.1.tar.gz | 5.4 kB | Without provenance | Details for multi-prophet-1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| multi_prophet-1.1.1-py3-none-any.whl | Python 3 | none | any | Details for multi_prophet-1.1.1-py3-none-any.whl |
Total release size: 10.9 kB
Release files / multi-prophet-1.1.1.tar.gz
| Download URL | multi-prophet-1.1.1.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4ed88ae69f14d81c21969ed4527db7df9899d6d55afda63e3c29fe93e54eaf45
|
|
BLAKE2b-256 checksum How to use checksums |
2bf9a19e7ad91f9ad491eba2296472e0fd15018d006e0196d2402b75d205ae56
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.8.2
|
Release files / multi_prophet-1.1.1-py3-none-any.whl
| Download URL | multi_prophet-1.1.1-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dcfed33058be531d316db87c0130a0c58ea45ab937fc1c4083e0f7bb8ca34265
|
|
BLAKE2b-256 checksum How to use checksums |
d3c3733b6d2ef622eea553cc2c813a4e0bb52d7cc45cf7f42c7e1f1698aa88b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.8.2
|
Security for multi-prophet 1.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.