chronological_train_test_split#

openstef_models.utils.data_split.chronological_train_test_split(dataset: T, test_fraction: float) tuple[T, T][source]#

Split a dataset into train and test sets chronologically.

Divides the dataset into training and testing sets based on temporal order, ensuring that all training data comes before all testing data. This is the standard approach for time series forecasting evaluation.

The split point is determined by the test_fraction parameter, placing the most recent portion of data in the test set.

Parameters:
  • dataset (TypeVar(T, bound= TimeSeriesDataset)) – The dataset to split.

  • test_fraction (float) – Fraction of data to include in the test split.

  • dataset

  • test_fraction

Returns:

Tuple of (train_dataset, test_dataset).

Raises:
Return type:

tuple[TypeVar(T, bound= TimeSeriesDataset), TypeVar(T, bound= TimeSeriesDataset)]