FinerTimeSplit

class hcrystalball.model_selection.FinerTimeSplit(n_splits=10, horizon=10, between_split_lag=None)[source]

Bases: object

Time series cross-validator.

Provide train/test indices to split data in train/test sets. The corresponding training set consists only of observations that occurred prior to the observation that forms the test set. Thus, no future observations can be used in constructing the forecast.

Parameters
  • n_splits (int) – Number of splits.

  • horizon (int) – Number of steps ahead to make the forecast for.

  • between_split_lag (int) – Number of observations between individual splits.

Methods Summary

get_n_splits([X, y, groups])

Return number of splits regarles of provided parameters

split(X[, y, groups])

Generate indices to split the data into training and test sets.

Methods Documentation

get_n_splits(X=None, y=None, groups=None)[source]

Return number of splits regarles of provided parameters

Returns

Number of splits

Return type

int

split(X, y=None, groups=None)[source]

Generate indices to split the data into training and test sets.

Similar to scikit-learn API split. It takes n_splits*horizon from the tail of the data and use it for sequential generator of train/test indices.

Parameters
  • X (array-like) – Data container to be splitted to train and test data

  • y (Any) – ignored

  • groups (Any) – ignored

Yields

int – The next index to split the data into training and test set in a cross-validation.