Skip to content

Prophet integration guide#

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#

  • Sign up at
  • Create a project for storing your metadata.
  • Have Prophet installed.
  • (optional) To log the plots as interactive HTML visualizations, you need to have the Plotly graphing library installed.
    • You can enable logging as interactive HTML by setting the log_interactive parameter to True where applicable.
    • Otherwise, the plots are recorded as static images by default.

Installing the integration#

To use your pre-installed version of Neptune together with the integration:

pip install -U neptune-prophet
conda install -c conda-forge neptune-prophet

To install both Neptune and the integration:

pip install -U "neptune[prophet]"
conda install -c conda-forge neptune neptune-prophet
Passing your Neptune credentials

Once you've registered and created a project, set your Neptune API token and full project name to the NEPTUNE_API_TOKEN and NEPTUNE_PROJECT environment variables, respectively.

export NEPTUNE_API_TOKEN="h0dHBzOi8aHR0cHM.4kl0jvYh3Kb8...6Lc"

To find your API token: In the bottom-left corner of the Neptune app, expand the user menu and select Get my API token.

export NEPTUNE_PROJECT="ml-team/classification"

To find your project: Your full project name has the form workspace-name/project-name. To copy the name, click the menu in the top-right corner and select Properties.

While it's not recommended especially for the API token, you can also pass your credentials in the code when initializing Neptune.

run = neptune.init_run(
    project="ml-team/classification",  # your full project name here
    api_token="h0dHBzOi8aHR0cHM6Lkc78ghs74kl0jvYh...3Kb8",  # your API token here

For more help, see Setting Neptune credentials.

If you'd rather follow the guide without any setup, you can run the example in Colab .

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