chainer.training.triggers.MaxValueTrigger

class chainer.training.triggers.MaxValueTrigger(key, trigger=(1, 'epoch'))[source]

Trigger invoked when specific value becomes maximum.

For example you can use this trigger to take snapshot on the epoch the validation accuracy is maximum.

Parameters:
  • key (str) – Key of value. The trigger fires when the value associated with this key becomes maximum.
  • trigger – Trigger that decides the comparison interval between current best value and new value. This must be a tuple in the form of <int>, 'epoch' or <int>, 'iteration' which is passed to IntervalTrigger.

Methods

__call__(trainer)[source]

Decides whether the extension should be called on this iteration.

Parameters:trainer (Trainer) – Trainer object that this trigger is associated with. The observation of this trainer is used to determine if the trigger should fire.
Returns:
True if the corresponding extension should be invoked in
this iteration.
Return type:bool