etna.analysis.plot_residuals#
- plot_residuals(forecast_df: DataFrame, ts: TSDataset, feature: str | Literal['timestamp'] = 'timestamp', transforms: Sequence[Transform] = (), segments: List[str] | None = None, columns_num: int = 2, figsize: Tuple[int, int] = (10, 5))[source]#
Plot residuals for predictions from backtest against some feature.
- Parameters:
forecast_df (DataFrame) – forecasted dataframe with timeseries data
ts (TSDataset) – dataframe of timeseries that was used for backtest
feature (str | Literal['timestamp']) – feature name to draw against residuals, if “timestamp” plot residuals against the timestamp
transforms (Sequence[Transform]) – sequence of transforms to get feature column
columns_num (int) – number of columns in subplots
figsize (Tuple[int, int]) – size of the figure per subplot with one segment in inches
- Raises:
ValueError: – if feature isn’t present in the dataset after applying transformations
Notes
Parameter
transforms
is necessary because some pipelines doesn’t save features in their forecasts, e.g.etna.ensembles
pipelines.