TimeSeriesPredictor.backtest_targets¶
- TimeSeriesPredictor.backtest_targets(data: TimeSeriesDataFrame | None = None, *, num_val_windows: int | None = None, val_step_size: int | None = None) list[TimeSeriesDataFrame][source]¶
Return target values for each validation window.
Returns the actual target values corresponding to each validation window used in
backtest_predictions(). The returned targets are aligned with the predictions, making it easy to compute custom evaluation metrics or analyze forecast errors.- Parameters:
data (TimeSeriesDataFrame, optional) –
Time series data to extract targets from. If
None, returns the targets from the validation windows used during training.If provided, all time series in
datamust have length at leastprediction_length + (num_val_windows - 1) * val_step_size + 1.The names and dtypes of columns and static features in
datamust match thetrain_dataused to train the predictor.num_val_windows (int, optional) –
Number of validation windows to extract targets for. If
None, uses thenum_val_windowsvalue from training configuration whendata=None, otherwise defaults to 1.This should match the
num_val_windowsargument passed tobacktest_predictions().val_step_size (int, optional) –
Number of time steps between the start of consecutive validation windows. If
None, defaults toprediction_length.This should match the
val_step_sizeargument passed tobacktest_predictions().
- Returns:
Target values for each validation window. Returns a list of length
num_val_windows, where each element contains the full time series data for one validation window. Each dataframe includes both historical context and the lastprediction_lengthtime steps that represent the target values to compare against predictions.The returned targets are aligned with the output of
backtest_predictions(), sotargets[i]corresponds topredictions[i]for the i-th validation window.- Return type:
list[TimeSeriesDataFrame]
See also
backtest_predictionsReturn predictions for multiple validation windows.
evaluateEvaluate forecast accuracy on a hold-out set.