Core Module Documentation#

neuralprophet.plot_forecast_plotly.conformal_plot_plotly(fig, df_cp_lo, df_cp_hi, plotting_backend)#

Plot conformal prediction intervals and quantile regression intervals in one plot

Parameters
  • fig (plotly.graph_objects.Figure) – Figure showing the quantile regression intervals

  • df_cp_lo (dataframe) – dataframe containing the lower bound of the conformal prediction intervals

  • df_cp_hi (dataframe) – dataframe containing the upper bound of the conformal prediction intervals

neuralprophet.plot_forecast_plotly.get_forecast_component_props(fcst, comp_name, plot_name=None, multiplicative=False, bar=False, rolling=None, add_x=False, fill=False, num_overplot=None, **kwargs)#

Prepares a dictionary for plotting the selected forecast component with plotly.

Parameters
  • fcst (pd.DataFrame) – Output of m.predict

  • comp_name (str) – Name of the component to plot

  • plot_name (str) – Name of the plot

  • multiplicative (bool) – Flag whetther to plot the y-axis as percentage

  • bar (bool) – Flag whether to plot the component as a bar

  • rolling (int) – Rolling average to underplot

  • add_x (bool) – Flag whether to add x-symbols to the plotted points

  • fill (bool) – Add fill between signal and x(y=0) axis

  • num_overplot (int) – the number of forecast in focus

Return type

Dictionary with plotly traces, xaxis and yaxis

neuralprophet.plot_forecast_plotly.get_multiforecast_component_props(fcst, comp_name, plot_name=None, multiplicative=False, bar=False, focus=1, num_overplot=None, **kwargs)#

Prepares a dictionary for plotting the selected multi forecast component with plotly

Parameters
  • fcst (pd.DataFrame) – Output of m.predict

  • comp_name (str) – Name of the component to plot

  • plot_name (str) – Name of the plot

  • multiplicative (bool) – Flag whetther to plot the y-axis as percentage

  • bar (bool) – Flag whether to plot the component as a bar

  • focus (int) – Id of the forecast to display

  • add_x (bool) – Flag whether to add x-symbols to the plotted points

Return type

Dictionary with plotly traces, xaxis and yaxis

neuralprophet.plot_forecast_plotly.get_seasonality_props(m, fcst, df_name='__df__', comp_name='weekly', multiplicative=False, quick=False, **kwargs)#

Prepares a dictionary for plotting the selected seasonality with plotly

Parameters
  • m (NeuralProphet) – Fitted NeuralProphet model

  • fcst (pd.DataFrame) – Output of m.predict

  • df_name (str) – ID from time series that should be plotted

  • comp_name (str) – Name of the component to plot

  • multiplicative (bool) – Flag whetther to plot the y-axis as percentage

  • quick (bool) – Use quick low-level call of model

Return type

Dictionary with plotly traces, xaxis and yaxis

neuralprophet.plot_forecast_plotly.plot(fcst, quantiles, xlabel='ds', ylabel='y', highlight_forecast=None, line_per_origin=False, figsize=(700, 210), resampler_active=False, plotly_static=False)#

Plot the NeuralProphet forecast

Parameters
  • fcst (pd.DataFrame) – Output of m.predict

  • quantiles (list) – Quantiles for which the forecasts are to be plotted.

  • xlabel (str) – Label name on X-axis

  • ylabel (str) – Label name on Y-axis

  • highlight_forecast (int) – i-th step ahead forecast to highlight.

  • line_per_origin (bool) – Print a line per forecast of one per forecast age

  • figsize (tuple) – Width, height in inches.

  • resampler_active (bool) – Flag whether to activate the plotly-resampler

  • plotly_static (bool) – Flag whether to generate a static svg image

Return type

Plotly figure

neuralprophet.plot_forecast_plotly.plot_components(m, fcst, plot_configuration, df_name='__df__', one_period_per_season=False, figsize=(700, 210), resampler_active=False, plotly_static=False)#

Plot the NeuralProphet forecast components.

Parameters
  • m (NeuralProphet) – Fitted model

  • fcst (pd.DataFrame) – Output of m.predict

  • plot_configuration (dict) – dict of configured components to plot

  • df_name (str) – ID from time series that should be plotted

  • one_period_per_season (bool) – Plot one period per season, instead of the true seasonal components of the forecast.

  • figsize (tuple) – Width, height in inches.

  • resampler_active (bool) – Flag whether to activate the plotly-resampler

  • plotly_static (bool) – Flag whether to generate a static svg image

Return type

Plotly figure

neuralprophet.plot_forecast_plotly.plot_interval_width_per_timestep(q_hats, method, resampler_active=False)#

Plot the nonconformity scores as well as the one-sided interval width (q).

Parameters
  • q_hats (dataframe) – prediction interval widths (or q) for each timestep

  • method (str) –

    name of conformal prediction technique used

    Options
    • (default) naive: Naive or Absolute Residual

    • cqr: Conformalized Quantile Regression

  • resampler_active (bool) – Flag whether to activate the plotly-resampler

Returns

Figure showing the q-values for each timestep

Return type

plotly.graph_objects.Figure

neuralprophet.plot_forecast_plotly.plot_nonconformity_scores(scores, alpha, q, method, resampler_active=False)#

Plot the NeuralProphet forecast components.

Parameters
  • scores (dict) – nonconformity scores

  • alpha (float) – user-specified significance level of the prediction interval

  • q (float or list) – prediction interval width (or q) for symmetric prediction interval or for upper and lower prediction interval, respectively

  • method (str) –

    name of conformal prediction technique used

    Options
    • (default) naive: Naive or Absolute Residual

    • cqr: Conformalized Quantile Regression

  • resampler_active (bool) – Flag whether to activate the plotly-resampler

Returns

Figure showing the nonconformity score with horizontal line for q-value based on the significance level or alpha

Return type

plotly.graph_objects.Figure