Skip to content

Working with Prophet#

Open in Colab

Custom dashboard displaying metadata logged with Prophet

Prophet is a popular time-series forecasting library.

With the Neptune–Prophet integration, you can keep track of parameters, forecast data frames, residual diagnostic charts, cross-validation folds, and other metadata while training models with Prophet.

See in Neptune  Code examples 


Before you start#

Installing the Neptune-Prophet integration#

pip install -U neptune-prophet

Logging options#

In order to track the metadata to Neptune, you need to initialize a Neptune run.

import neptune

run = neptune.init_run()
Haven't registered?

If you haven't registered or set up your credentials, you can log anonymously to the public project:

run = neptune.init_run(

You can then use the run object to track metadata with the functions listed below.

Logging Prophet summary#


You can log all relevant metadata at once with this function, such as forecast plots and residual diagnostics.


Parameter         Description
model Fitted Prophet model object.
df (optional) The dataset that was used for making the forecast. If provided, additional plots will be recorded.
fcst (optional) Forecast returned by Prophet. If not provided, it'll be calculated using the df data.
log_charts Additionally save the diagnostic plots. Defaults to True.
log_interactive Save the plots as interactive HTML files. Requires the Plotly library. Defaults to False.


Dictionary with all the plots.


import pandas as pd
from prophet import Prophet
import neptune
import neptune.integrations.prophet as npt_utils

run = neptune.init_run()

dataset = pd.read_csv(
model = Prophet()

run["prophet_summary"] = npt_utils.create_summary(
    model=model, df=dataset, log_interactive=True

Getting the model configuration#

To extract the configuration from the Prophet model object, use the get_model_config() function:

run = neptune.init_run()
dataset = ...
model = Prophet()

run["model_config"] = npt_utils.get_model_config(model)

Getting the serialized model#

To serialize the Prophet model, you can use the get_serialized_model() function:

run = neptune.init_run()
dataset = ...
model = Prophet()

run["model"] = npt_utils.get_serialized_model(model)

Getting forecast components#

To get the forecast components (such as trend and monthly seasonality) produced by Prophet, use the get_forecast_components() function:

run = neptune.init_run()
dataset = ...
model = Prophet()
predicted = model.predict(dataset)

run["forecast_components"] = npt_utils.get_forecast_components(model, predicted)

Logging forecast plots#

To save Prophet plots (such as forecast components, changepoints, forecast with prediction interval), use the create_forecast_plots() function:
predicted = model.predict(dataset)

run["forecast_plots"] = npt_utils.create_forecast_plots(model, predicted)

Logging residual forecast plots#

To save additional diagnostic plots (such as histogram of residuals, ACF plot, QQ-plot for residuals) to Neptune, use the create_residual_diagnostics_plots() function:
predicted = model.predict(dataset)

run["residual_diagnostics_plot"] = npt_utils.create_residual_diagnostics_plots(
    predicted, dataset.y

See also

For details, see API referenceProphet