TimeSeriesIterator

class lightautoml.validation.np_iterators.TimeSeriesIterator(datetime_col, n_splits=5, date_splits=None, sorted_kfold=False)[source]

Bases: object

Time Series Iterator.

static split_by_dates(datetime_col, splitter)[source]

Create indexes of folds splitted by thresholds.

Parameters
  • datetime_col – Column with value which can be interpreted as time/ordinal value (ex: np.datetime64).

  • splitter – List of thresholds (same value as ).

Returns

Array of folds’ indexes.

Return type

folds

static split_by_parts(datetime_col, n_splits)[source]

Create indexes of folds splitted into equal parts.

Parameters
  • datetime_col – Column with value which can be interpreted as time/ordinal value (ex: np.datetime64).

  • n_splits (int) – Number of splits(folds).

Returns

Array of folds’ indexes.

Return type

folds

__init__(datetime_col, n_splits=5, date_splits=None, sorted_kfold=False)[source]

Generates time series data split. Sorter - include left, exclude right.

Parameters
  • datetime_col – Column with value which can be interpreted as time/ordinal value (ex: np.datetime64).

  • n_splits (Optional[int]) – Number of splits.

  • date_splits (Optional[Sequence]) – List of thresholds.

  • sorted_kfold (bool) – is sorted.