orbit.diagnostics package¶
Submodules¶
orbit.diagnostics.plot module¶
-
orbit.diagnostics.plot.
metric_horizon_barplot
(df, model_col='model', pred_horizon_col='pred_horizon', metric_col='smape', bar_width=0.1, path=None, figsize=None, fontsize=None, is_visible=False)¶
-
orbit.diagnostics.plot.
plot_posterior_params
(mod, kind='density', n_bins=20, ci_level=0.95, pair_type='scatter', figsize=None, path=None, fontsize=None, incl_trend_params=False, incl_smooth_params=False, is_visible=True)¶ Data Viz for posterior samples
mod : orbit model object kind : str, {‘density’, ‘trace’, ‘pair’}
which kind of plot to be made. Currently, trace plot may not represent the actual sample process for different chainse since this information is not stored in orbit model objects.
- n_binsint; default 20
number of bin, used in the histogram plotting
- ci_levelfloat, between 0 and 1
confidence interval level
- pair_typestr, {‘scatter’, ‘reg’}
dot plotting type for off-diagonal plots in pair plot
- figsizetuple; optional
figure size
- pathstr; optional
dir path to save the chart
- fontsize: int; optional
fontsize of the title
- incl_trend_paramsbool
if plot trend parameters; default False
- incl_smooth_paramsbool
if plot smoothing parameters; default False
- is_visible: boolean
whether we want to show the plot. If called from unittest, is_visible might = False.
- Returns
fig
- Return type
plt object
-
orbit.diagnostics.plot.
plot_predicted_components
(predicted_df, date_col, prediction_percentiles=None, plot_components=None, title='', figsize=None, path=None, fontsize=None, is_visible=True)¶ - Plot predicted componenets with the data frame of decomposed prediction where components
has been pre-defined as trend, seasonality and regression. Parameters ———- predicted_df: pd.DataFrame
predicted data response data frame. two columns required: actual_col and pred_col. If user provide pred_percentiles_col, it needs to include them as well.
- date_col: str
the date column name
- prediction_percentiles: list
a list should consist exact two elements which will be used to plot as lower and upper bound of confidence interval
- plot_components: list
a list of strings to show the label of components to be plotted; by default, it uses values in orbit.constants.constants.PredictedComponents.
- title: str; optional
title of the plot
- figsize: tuple; optional
figsize pass through to matplotlib.pyplot.figure()
- path: str; optional
path to save the figure
- fontsize: int; optional
fontsize of the title
- is_visible: boolean
whether we want to show the plot. If called from unittest, is_visible might = False.
- Returns
None
-
orbit.diagnostics.plot.
plot_predicted_data
(training_actual_df, predicted_df, date_col, actual_col, pred_col='prediction', prediction_percentiles=None, title='', test_actual_df=None, is_visible=True, figsize=None, path=None, fontsize=None)¶ plot training actual response together with predicted data; if actual response of predicted data is there, plot it too. :param training_actual_df: training actual response data frame. two columns required: actual_col and date_col :type training_actual_df: pd.DataFrame :param predicted_df: predicted data response data frame. two columns required: actual_col and pred_col. If
user provide prediction_percentiles, it needs to include them as well in such prediction_{x} where x is the correspondent percentiles
- Parameters
prediction_percentiles (list) – list of two elements indicates the lower and upper percentiles
date_col (str) – the date column name
actual_col (str) –
pred_col (str) –
title (str) – title of the plot
test_actual_df (pd.DataFrame) – test actual response dataframe. two columns required: actual_col and date_col
is_visible (boolean) – whether we want to show the plot. If called from unittest, is_visible might = False.
figsize (tuple) – figsize pass through to matplotlib.pyplot.figure()
path (str) – path to save the figure
fontsize (int) – fontsize of the title
- Returns
- Return type
None.