Core Module Documentation

neuralprophet.plot_model_parameters.plot_custom_season(m, comp_name, ax=None, figsize=(10, 6), df_name='__df__')

Plot any seasonal component of the forecast.

Parameters
  • m (NeuralProphet) – Fitted model

  • comp_name (str) – Name of seasonality component

  • ax (matplotlib axis) – Matplotlib Axes to plot on

  • focus (int) – Show weights for this forecast, if provided

  • figsize (tuple) –

    Width, height in inches, ignored if ax is not None.

    Note

    Default value is set to figsize = (10, 6)

  • df_name (str) –

    Name of dataframe to refer to data params from original keys of train dataframes

    Note

    Only used for local normalization in global modeling

Returns

List of Artist objects containing seasonal forecast component

Return type

matplotlib.artist.Artist

neuralprophet.plot_model_parameters.plot_daily(m, comp_name='daily', quick=True, ax=None, figsize=(10, 6), df_name='__df__')

Plot the daily component of the forecast.

Parameters
  • m (NeuralProphet) – Fitted model

  • comp_name (str) – Name of seasonality component if previously changed from default daily

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

  • ax (matplotlib axis) – Matplotlib Axes to plot on

  • figsize (tuple) –

    Width, height in inches, ignored if ax is not None.

    Note

    Default value is set to figsize = (10, 6)

  • df_name (str) –

    Name of dataframe to refer to data params from original keys of train dataframes

    Note

    Only used for local normalization in global modeling

Returns

List of Artist objects containing weekly forecast component

Return type

matplotlib.artist.Artist

neuralprophet.plot_model_parameters.plot_lagged_weights(weights, comp_name, focus=None, ax=None, figsize=(10, 6))

Make a barplot of the importance of lagged inputs.

Parameters
  • weights (list) – tuples of (name, weights)

  • comp_name (str) – Name of lagged inputs

  • focus (int) – Show weights for this forecast, if provided

  • ax (matplotlib axis) – Matplotlib Axes to plot on

  • figsize (tuple) –

    Width, height in inches, ignored if ax is not None.

    Note

    Default value is set to figsize = (10, 6)

Returns

List of Artist objects containing barplot

Return type

matplotlib.artist.Artist

neuralprophet.plot_model_parameters.plot_parameters(m, forecast_in_focus=None, weekly_start=0, yearly_start=0, figsize=None, df_name=None)

Plot the parameters that the model is composed of, visually.

Parameters
  • m (NeuralProphet) – Fitted model

  • forecast_in_focus (int) – n-th step ahead forecast AR-coefficients to plot

  • weekly_start (int) –

    Specifying the start day of the weekly seasonality plot

    Options
    • (default) weekly_start = 0: starts the week on Sunday

    • weekly_start = 1: shifts by 1 day to Monday, and so on

  • yearly_start (int) –

    Specifying the start day of the yearly seasonality plot.

    Options
    • (default) yearly_start = 0: starts the year on Jan 1

    • yearly_start = 1: shifts by 1 day to Jan 2, and so on

  • figsize (tuple) –

    Width, height in inches.

    Note

    Default value is set to None -> automatic figsize = (10, 3 * npanel)

  • df_name (str) –

    Name of dataframe to refer to data params from original keys of train dataframes

    Note

    Only used for local normalization in global modeling

Returns

Figure showing the NeuralProphet parameters

Return type

matplotlib.pyplot.figure

Examples

Base usage of plot_parameters()

>>> from neuralprophet import NeuralProphet
>>> m = NeuralProphet()
>>> metrics = m.fit(df, freq="D")
>>> future = m.make_future_dataframe(df=df, periods=365)
>>> forecast = m.predict(df=future)
>>> fig_param = m.plot_parameters()
neuralprophet.plot_model_parameters.plot_scalar_weights(weights, plot_name, focus=None, ax=None, figsize=(10, 6))

Make a barplot of the regressor weights.

Parameters
  • weights (list) – tuples of (name, weights)

  • plot_name (str) – Name of the plot Title

  • focus (int) – Show weights for this forecast, if provided

  • ax (matplotlib axis) – Matplotlib Axes to plot on

  • figsize (tuple) –

    Width, height in inches, ignored if ax is not None.

    Note

    Default value is set to figsize = (10, 6)

Returns

List of Artist objects containing barplot

Return type

matplotlib.artist.Artist

neuralprophet.plot_model_parameters.plot_trend(m, ax=None, plot_name='Trend', figsize=(10, 6), df_name='__df__')

Make a barplot of the magnitudes of trend-changes.

Parameters
  • m (NeuralProphet) – Fitted model

  • ax (matplotlib axis) – Matplotlib Axes to plot on

  • plot_name (str) – Name of the plot Title

  • figsize (tuple) –

    Width, height in inches, ignored if ax is not None.

    Note

    Default value is set to figsize = (10, 6)

  • df_name (str) –

    Name of dataframe to refer to data params from original keys of train dataframes

    Note

    Only used for local normalization in global modeling

Returns

List of Artist objects containing barplot

Return type

matplotlib.artist.Artist

neuralprophet.plot_model_parameters.plot_trend_change(m, ax=None, plot_name='Trend Change', figsize=(10, 6), df_name='__df__')

Make a barplot of the magnitudes of trend-changes.

Parameters
  • m (NeuralProphet) – Fitted model

  • ax (matplotlib axis) – Matplotlib Axes to plot on

  • plot_name (str) – Name of the plot Title

  • figsize (tuple) –

    Width, height in inches, ignored if ax is not None.

    Note

    Default value is set to figsize = (10, 6)

  • df_name (str) –

    Name of dataframe to refer to data params from original keys of train dataframes

    Note

    Only used for local normalization in global modeling

Returns

List of Artist objects containing barplot

Return type

matplotlib.artist.Artist

neuralprophet.plot_model_parameters.plot_weekly(m, comp_name='weekly', weekly_start=0, quick=True, ax=None, figsize=(10, 6), df_name='__df__')

Plot the weekly component of the forecast.

Parameters
  • m (NeuralProphet) – Fitted model

  • comp_name (str) – Name of seasonality component

  • weekly_start (int) –

    Specifying the start day of the weekly seasonality plot

    Options
    • (default) weekly_start = 0: starts the week on Sunday

    • weekly_start = 1: shifts by 1 day to Monday, and so on

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

  • ax (matplotlib axis) – Matplotlib Axes to plot on

  • figsize (tuple) –

    Width, height in inches, ignored if ax is not None.

    Note

    Default value is set to figsize = (10, 6)

  • df_name (str) –

    Name of dataframe to refer to data params from original keys of train dataframes

    Note

    Only used for local normalization in global modeling

Returns

List of Artist objects containing weekly forecast component

Return type

matplotlib.artist.Artist

neuralprophet.plot_model_parameters.plot_yearly(m, comp_name='yearly', yearly_start=0, quick=True, ax=None, figsize=(10, 6), df_name='__df__')

Plot the yearly component of the forecast.

Parameters
  • m (NeuralProphet) – Fitted model

  • comp_name (str) – Name of seasonality component

  • yearly_start (int) –

    Specifying the start day of the yearly seasonality plot

    Options
    • (default) yearly_start = 0: starts the year on Jan 1

    • yearly_start = 1: shifts by 1 day to Jan 2, and so on

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

  • ax (matplotlib axis) – Matplotlib Axes to plot on

  • figsize (tuple) –

    Width, height in inches, ignored if ax is not None.

    Note

    Default value is set to figsize = (10, 6)

  • df_name (str) –

    Name of dataframe to refer to data params from original keys of train dataframes

    Note

    Only used for local normalization in global modeling

Returns

List of Artist objects containing yearly forecast component

Return type

matplotlib.artist.Artist