plot_residuals¶
- plot_residuals(forecast_df: pandas.core.frame.DataFrame, ts: TSDataset, feature: Union[str, Literal['timestamp']] = 'timestamp', transforms: Sequence[Transform] = (), segments: Optional[List[str]] = None, columns_num: int = 2, figsize: Tuple[int, int] = (10, 5))[source]¶
Plot residuals for predictions from backtest against some feature.
- Parameters
forecast_df (pandas.core.frame.DataFrame) – forecasted dataframe with timeseries data
ts (TSDataset) – dataframe of timeseries that was used for backtest
feature (Union[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
segments (Optional[List[str]]) – segments to use
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.