TaskTimer

class lightautoml.utils.timer.TaskTimer(pipe_timer, key=None, score=1.0, overhead=1, mode=1, default_tuner_time_rate=0.7)[source]

Bases: lightautoml.utils.timer.Timer

Timer is used to control time over single ML task run.

It decides how much time is ok to spend on tuner and if we have enough time to calc more folds.

property in_progress

Check if the task is running.

Return type

bool

__init__(pipe_timer, key=None, score=1.0, overhead=1, mode=1, default_tuner_time_rate=0.7)[source]
Parameters
  • pipe_timer (PipelineTimer) – Global automl timer.

  • key (Optional[str]) – String name that will be associated with this task.

  • score (float) – Time score for current task. For ex. if you want to give more of total time to task set it > 1.

  • overhead (Optional[float]) – See overhead of PipelineTimer.

  • mode (int) – See mode for PipelineTimer.

  • default_tuner_time_rate (float) – If no timing history for the moment of estimating tuning time, timer will use this rate of time_left.

start()[source]

Starts counting down.

Returns

self.

set_control_point()[source]

Set control point.

Updates the countdown and time left parameters.

write_run_info()[source]

Collect timer history.

get_run_results()[source]

Get timer history.

Return type

Optional[ndarray]

Returns

None if there is no history, or array with history of runs.

get_run_scores()[source]

Get timer scores.

Return type

Optional[ndarray]

Returns

None if there is no scores, or array with scores of runs.

estimate_folds_time(n_folds=1)[source]

Estimate time for n_folds.

Parameters

n_folds (int) – Number of folds.

Return type

Optional[float]

Returns

Estimated time needed to run all n_folds.

estimate_tuner_time(n_folds=1)[source]

Estimates time that is ok to spend on tuner.

Return type

float

Returns

How much time timer will be able spend on tuner.

time_limit_exceeded()[source]

Estimate time limit and send results to parent timer.

Return type

bool

Returns

True if time limit exceeded.

split_timer(n_parts)[source]

Split the timer into equal-sized tasks.

Parameters

n_parts (int) – Number of tasks.

Return type

List[TaskTimer]