time_series_split¶
Module Contents¶
Classes Summary¶
Rolling Origin Cross Validation for time series problems. |
Contents¶
-
class
evalml.preprocessing.data_splitters.time_series_split.
TimeSeriesSplit
(max_delay=0, gap=0, date_index=None, n_splits=3)[source]¶ Rolling Origin Cross Validation for time series problems.
This class uses max_delay and gap values to take into account that evalml time series pipelines perform some feature and target engineering, e.g delaying input features and shifting the target variable by the desired amount. If the data that will be split already has all the features and appropriate target values, and then set max_delay and gap to 0.
- Parameters
max_delay (int) – Max delay value for feature engineering. Time series pipelines create delayed features from existing features. This process will introduce NaNs into the first max_delay number of rows. The splitter uses the last max_delay number of rows from the previous split as the first max_delay number of rows of the current split to avoid “throwing out” more data than in necessary. Defaults to 0.
gap (int) – Gap used in time series problem. Time series pipelines shift the target variable by gap rows. Defaults to 0.
date_index (str) – Name of the column containing the datetime information used to order the data. Defaults to None.
n_splits (int) – number of data splits to make. Defaults to 3.
Methods
Get the number of data splits.
Get the time series splits.
-
split
(self, X, y=None, groups=None)[source]¶ Get the time series splits.
X and y are assumed to be sorted in ascending time order. This method can handle passing in empty or None X and y data but note that X and y cannot be None or empty at the same time.
- Parameters
X (pd.DataFrame, None) – Features to split.
y (pd.DataFrame, None) – Target variable to split.
groups – Ignored but kept for compatibility with sklearn api.
- Returns
Iterator of (train, test) indices tuples.