Core Module Documentation#
- neuralprophet.plot_utils.check_if_configured(m, components, error_flag=False)#
Check if components were set in the model configuration by the user.
- Parameters
m (NeuralProphet) – Fitted NeuralProphet model
components (str or list, optional) –
name or list of names of components to check
trend
trend_rate_change
seasonality
autoregression
lagged_regressors`
events
``future_regressors`
uncertainty
error_flag (bool) – Activate to raise a ValueError if component has not been configured
- Returns
list of components only including the components set in the model configuration
- Return type
components
- neuralprophet.plot_utils.get_valid_configuration(m, components=None, df_name=None, valid_set=None, validator=None, forecast_in_focus=None, quantile=0.5)#
Validate and adapt the selected components to be plotted.
- Parameters
m (NeuralProphet) – Fitted NeuralProphet model
components (str or list, optional) – name or list of names of components to validate and adapt
df_name (str) – ID from time series that should be plotted
valid_set (str or list, optional) –
name or list of names of components that are defined as valid option
(default)``None``: All components the user set in the model configuration are validated and adapted
trend
seasonality
autoregression
lagged_regressors
future_regressors
events
uncertainty
validator (str) –
specifies the validation purpose to customize
plot_parameters
: customize for plot_parameters() functionplot_components
: customize for plot_components() function
forecast_in_focus (int) –
optinal, i-th step ahead forecast to plot
Note
None (default): plot self.highlight_forecast_step_n by default
quantile (float) –
The quantile for which the model parameters are to be plotted
Note
0.5 (default): Parameters will be plotted for the median quantile.
- Returns
valid_configuration – dict of validated components and values to be plotted
- Return type
dict
- neuralprophet.plot_utils.is_notebook()#
Determine if the code is being executed in a Jupyter notebook environment.
- Returns
True if the code is being executed in a Jupyter notebook, False otherwise.
- Return type
bool
- neuralprophet.plot_utils.predict_one_season(m, quantile, name, n_steps=100, df_name='__df__')#
Predicts the seasonal component given a number of time steps.
- Parameters
m (NeuralProphet) – Fitted NeuralProphet model
quantile (float) – The quantile for which the season is predicted
name (str) – Name of seasonality component
n_steps (int) – number of prediction steps related to the season frequency
df_name – Name of dataframe to refer to data params from original keys of train dataframes
- neuralprophet.plot_utils.predict_season_from_dates(m, dates, name, quantile, df_name='__df__')#
Predicts the seasonal component given a date range.
- mNeuralProphet
Fitted NeuralProphet model
- dates: pd.datetime
date range for prediction
- name: str
Name of seasonality component
- quantile: float
The quantile for which the season is predicted
- df_name: str
Name of dataframe to refer to data params from original keys of train dataframes
- Returns
predicted – presdicted seasonal component
- Return type
OrderedDict
- neuralprophet.plot_utils.select_plotting_backend(model, plotting_backend)#
Automatically selects the plotting backend based on the global plotting_backend and plotting_backend set by the user. If the plotting backend is selected as “plotly-resampler”, triggers warning message.
- Parameters
model (NeuralProphet) – The configured model.
plotting_backend (str) – The plotting backend to use.
- Returns
The new plotting backend.
- Return type
str
- neuralprophet.plot_utils.set_y_as_percent(ax)#
Set y axis as percentage
- Parameters
ax (matplotlib axis) – Respective y axis element
- Returns
Manipulated axis element
- Return type
matplotlib axis
- neuralprophet.plot_utils.validate_current_env_for_resampler(auto: bool = False) Optional[bool] #
Validate the current environment to check if it is a valid environment for plotly-resampler and if invalid trigger warning message.
- Parameters
auto (bool, optional) – If True, the function will automatically switch to a valid environment if the current environment is not valid. If False, the function will return None if the current environment is not valid.
- Returns
True if the current environment is a valid environment to run the code, False if the current environment is not a valid environment to run the code. None if the current environment is not a valid environment to run the code and the function did not switch to a valid environment.
- Return type
bool