deepr.hooks.EarlyStoppingHookFactory

class deepr.hooks.EarlyStoppingHookFactory(metric, max_steps_without_improvement, min_steps=0, mode=BestMode.DECREASE, run_every_secs=None, run_every_steps=None, final_step=None)[source]

Early Stopping Hook Factory

metric

Name of the metric to read from evaluation checkpoints.

Type:

str

max_steps_without_improvement

If no improvement in metric for this many step, stop.

Type:

int

min_steps

Do not attempt to early stop for this many steps.

Type:

int

mode

INCREASE or DECREASE. If DECREASE, lower metric is better.

Type:

BestMode

run_every_secs

If given, run early stopping hook every given seconds.

Type:

int, Optional

run_every_steps

If given, run early stopping hook every given steps.

Either run_every_secs or run_every_step should be given.

Type:

int, Optional

final_step

If given, will set the global_step to this value when early stopping.

This is a useful way to signal the end of training to the evaluator in the case of distributed training (early stopping causes issues with train_and_evaluate).

Type:

int, Optional

__init__(metric, max_steps_without_improvement, min_steps=0, mode=BestMode.DECREASE, run_every_secs=None, run_every_steps=None, final_step=None)[source]

Methods

__init__(metric, max_steps_without_improvement)