Facebook Prophet is a fast forecasting procedure for time series (calendar) data that provides complete automated forecasts that can be further tuned by hand.
When you run fbprophet with a comet_ml Experiment(), you will automatically get the following items logged:
Prophet code | What is automatically logged | How to control |
---|---|---|
Prophet() | logs all hyperparameters | Experiment(auto_param_logging=True) |
model.fit() | logs model | Experiment(log_graph=True) |
cross_validation() | logs items logged with model.fit() | Experiment(log_graph=True) |
plot() | logs matplotlib figure | COMET_AUTO_LOG_FIGURES=1 or in ~/.comet.config |
plot_components() | logs matplotlib figure | COMET_AUTO_LOG_FIGURES=1 or in ~/.comet.config |
plot_cross_validation_metric() | logs matplotlib figure | COMET_AUTO_LOG_FIGURES=1 or in ~/.comet.config |
You can control each of these by setting the Experiment argument to False
or the config variable to 0
.
Comet will also automatically log many other items, including:
- standard output and error
- Python packages
- GPU and CPU usage
- source code
- git data
- command-line arguments
- and more!
For a full list, please see: Automatic Logging. See the Python Configuration section for more details on configuring items.
Running Prophet with Comet¶
Install Prophet¶
To install Prophet:
bash
$ python -m pip fbprophet
Install Comet¶
If you haven't already, install comet_ml
.
bash
$ pip install comet_ml
Make sure to set up your Comet credentials. Get your API key at www.comet.ml
Make sure your API key available and set which Comet project you’d
like the experiment details to report to. Replace the following ...
with the appropriate values:
bash
$ export COMET_API_KEY="..."
$ export COMET_PROJECT_NAME="..."
See the Python Configuration section for more options.
End-to-end Example¶
```python import comet_ml
import os import pandas as pd from fbprophet import Prophet from fbprophet.diagnostics import cross_validation from fbprophet.plot import plot_cross_validation_metric
experiment = comet_ml.Experiment()
You'll need a csv data file:¶
df = pd.read_csv("example_wp_log_peyton_manning.csv")
m = Prophet() m.fit(df)
future = m.make_future_dataframe(periods=365)
forecast = m.predict(future)
fig1 = m.plot(forecast) fig2 = m.plot_components(forecast)
df_cv = cross_validation(m, initial="730 days", period="180 days", horizon="365 days")
plot_cross_validation_metric(df_cv, "mse")
experiment.end() ```