composeml.LabelMaker.slice

LabelMaker.slice(df, num_examples_per_instance, minimum_data=None, maximum_data=None, gap=None, drop_empty=True)[source]

Generates data slices of target dataframe.

Parameters
  • df (DataFrame) – Data frame to create slices on.

  • num_examples_per_instance (int) – Number of examples per unique instance of target dataframe.

  • minimum_data (int or str or Series) – The amount of data needed before starting the search. Defaults to the first value in the time index. The value can be a datetime string to directly set the first cutoff time or a timedelta string to denote the amount of data needed before the first cutoff time. The value can also be an integer to denote the number of rows needed before the first cutoff time. If a Series, minimum_data should be datetime string, timedelta string, or integer values with a unique set of target groups as the corresponding index.

  • maximum_data (str) – Maximum data before stopping the search. Default value is last time of index.

  • gap (str or int) – Time between examples. Default value is window size. If an integer, search will start on the first event after the minimum data.

  • drop_empty (bool) – Whether to drop empty slices. Default value is True.

Returns

Returns a generator of data slices.

Return type

ds (generator)