tsicl.plot.forecasting.plot_sample_forecast#

tsicl.plot.forecasting.plot_sample_forecast(quantiles: numpy.ndarray | torch.Tensor, y_ctx: numpy.ndarray | torch.Tensor, y_true: numpy.ndarray | torch.Tensor | None = None, quantiles_univar: numpy.ndarray | torch.Tensor | None = None, quantile_levels: list | None = None, plot_iqr: bool = False, z_normalize: bool = False, model_name: str = 'TS-ICL', iqr_bands: Sequence = ((0.05, 0.95), (0.25, 0.75)), max_points: int = -1) Tuple[matplotlib.figure.Figure, matplotlib.axes.Axes]#

Forecasting plot util for a single sample.

Parameters:
  • quantiles (np.ndarray | torch.Tensor) – array of predicted quantiles, shape (H, q)

  • y_ctx (np.ndarray | torch.Tensor) – available lookback as a 1D-array of len L (possibly with `NaN`s)

  • y_true (np.ndarray | torch.Tensor | None) – 1D-array of ground truth, len H

  • quantiles_univar (np.ndarray | torch.Tensor | None) – array of predicted quantiles when not using the covariates, shape (H, q)

  • quantile_levels (list | None) – list of the q quantile levels used in quantiles

  • plot_iqr (bool) – whether to plot InterQuantile Ranges, if available

  • z_normalize (bool) – whether to z-normalize all data before plotting (with stats computed from the lookback)

  • model_name (str) – model name to use in legend

  • iqr_bands (Sequence) – iterable sequence of IQRs bands (low, high) to plot

  • max_points (int) – how many time points to plot (will plot all if <0)

Returns:

The corresponding matplotlib figure and axes.