Time picker

Submodules

Time picker base class

class fleetrl.utils.time_picker.time_picker.TimePicker[source]

Bases: object

choose_time(db, freq, end_cutoff)[source]

Parent class for time picker objects :type db: Series :param db: dataframe from env :type freq: str :param freq: frequency specification string for pandas :type end_cutoff: int :param end_cutoff: amount of days cut off at the end to allow some buffer. In the eval time picker case, the end cutoff specifies the size of the validation set. :rtype: Timestamp :return: A chosen time stamp

Eval time picker

class fleetrl.utils.time_picker.eval_time_picker.EvalTimePicker(ep_len)[source]

Bases: TimePicker

Time picker for validation set. The amount of days and thus the train/validation split is set in time config.

choose_time(db, freq, end_cutoff)[source]

Randomly chooses a start time from the validation set.

Parameters:
  • db (Series) – Database

  • freq (str) – Time frequency

  • end_cutoff (int) – This is the size of the validation window. By default, the end_cutoff is 2 months, so Nov and Dec are the validation set.

Return type:

Timestamp

Returns:

start time, pd.TimeStamp

Random time picker

class fleetrl.utils.time_picker.random_time_picker.RandomTimePicker[source]

Bases: TimePicker

Picks a random time from the training set.

choose_time(db, freq, end_cutoff)[source]

Randomly chooses a start time from the validation set.

Parameters:
  • db (Series) – Database

  • freq (str) – Time frequency

  • end_cutoff (int) – Buffer that avoids problem with lookaheads

Return type:

Timestamp

Returns:

start time, pd.TimeStamp

Static time picker

class fleetrl.utils.time_picker.static_time_picker.StaticTimePicker(start_time='01/01/2021 00:00')[source]

Bases: TimePicker

Picks a static / always the same starting time.

choose_time(db, freq, end_cutoff)[source]

Parent class for time picker objects :type db: Series :param db: dataframe from env :type freq: str :param freq: frequency specification string for pandas :type end_cutoff: int :param end_cutoff: amount of days cut off at the end to allow some buffer. In the eval time picker case, the end cutoff specifies the size of the validation set. :rtype: Timestamp :return: A chosen time stamp