Trainer triggers¶
Interval¶
-
class
chainer.training.triggers.IntervalTrigger(period, unit)[source]¶ Trigger based on a fixed interval.
This trigger accepts iterations divided by a given interval. There are two ways to specify the interval: per iterations and epochs. Iteration means the number of updates, while epoch means the number of sweeps over the training dataset. Fractional values are allowed if the interval is a number of epochs; the trigger uses the iteration and epoch_detail attributes defined by the updater.
For the description of triggers, see
get_trigger().Parameters: -
__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 updater associated with 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
-
ManualSchedule¶
-
class
chainer.training.triggers.ManualScheduleTrigger(points, unit)[source]¶ Trigger invoked at specified point(s) of iterations or epochs.
This trigger accepts iterations or epochs indicated by given point(s). There are two ways to specify the point(s): iteration and epoch.
iterationmeans the number of updates, whileepochmeans the number of sweeps over the training dataset. Fractional values are allowed if the point is a number of epochs; the trigger uses theiterationandepoch_detailattributes defined by the updater.Parameters: -
__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 updater associated with 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
-
Minimum and maximum values¶
-
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 toIntervalTrigger.
-
class
chainer.training.triggers.MinValueTrigger(key, trigger=(1, 'epoch'))[source]¶ Trigger invoked when specific value becomes minimum.
For example you can use this trigger to take snapshot on the epoch the validation loss is minimum.
Parameters: - key (str) – Key of value. The trigger fires when the value associated with this key becomes minimum.
- 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 toIntervalTrigger.