Core Module Documentation#
- class neuralprophet.uncertainty.Conformal(alpha: Union[float, Tuple[float, float]], method: str, n_forecasts: int, quantiles: List[float])#
Conformal prediction dataclass
- Parameters
alpha (float or tuple) – user-specified significance level of the prediction interval, float if coverage error spread arbitrarily over left and right tails, tuple of two floats for different coverage error over left and right tails respectively
method (str) –
name of conformal prediction technique used
- Options
naive
: Naive or Absolute Residualcqr
: Conformalized Quantile Regression
n_forecasts (int) – optional, number of steps ahead of prediction time step to forecast
quantiles (list) – optional, list of quantiles for quantile regression uncertainty estimate
- plot(plotting_backend=None)#
Apply a given conformal prediction technique to get the uncertainty prediction intervals (or q-hats).
- Parameters
plotting_backend (str) –
specifies the plotting backend for the nonconformity scores plot, if any
Options *
plotly-resampler
: Use the plotly backend for plotting in resample mode. This mode uses theplotly-resampler package to accelerate visualizing large data by resampling it. For some environments (colab, pycharm interpreter) plotly-resampler might not properly vizualise the figures. In this case, consider switching to ‘plotly-auto’.
plotly
: Use the plotly backend for plottingmatplotlib
: use matplotlib for plotting- (default) None: Plotting backend ist set automatically. Use plotly with resampling for jupyterlab
notebooks and vscode notebooks. Automatically switch to plotly without resampling for all other environments.
- predict(df: pandas.core.frame.DataFrame, df_cal: pandas.core.frame.DataFrame, show_all_PI: bool = False) pandas.core.frame.DataFrame #
Apply a given conformal prediction technique to get the uncertainty prediction intervals (or q-hat) for test dataframe.
- Parameters
df (pd.DataFrame) – test dataframe
df_cal (pd.DataFrame) – calibration dataframe
show_all_PI (bool) – whether to return all prediction intervals (including quantile regression and conformal prediction)
Returns –
------- –
- pd.DataFrame
test dataframe with uncertainty prediction intervals
- neuralprophet.uncertainty.uncertainty_evaluate(df_forecast: pandas.core.frame.DataFrame) pandas.core.frame.DataFrame #
Evaluate conformal prediction on test dataframe.
- Parameters
df_forecast (pd.DataFrame) – forecast dataframe with the conformal prediction intervals
- Returns
table containing evaluation metrics such as interval_width and miscoverage_rate
- Return type
pd.DataFrame