You can Observe a lot by just watching
June 1, 2015 ยท View on GitHub
The following Observers are available:
- Observer : abstract class;
- ErrorMinima : monitors an error variable to keep track of its minima.
- EarlyStopper : upon reaching minima, saves Experiment and notifies Subscribers;
- ErrorMinima : monitors an error variable to keep track of its minima.
- AdaptiveDecay : decays learning rate when new minima on validation error isn't found;
- Logger : abstract logging class (prints reports to cmdline);
- FileLogger : basic file-based report logging;
- CompositeObserver : a composite of observers;
The monitored error variable can be obtained from an experiment
report or a Mediator Channel.
In the case of the report, the variable must be
located at a leaf of the report tree specified by a sequence of keys (branches) : error_report.
In this case, the object subscribes to doneEpoch channel in order to receive the reports
at the end of each epoch.
dp.ErrorMinima{...}
Constructs an ErrorMinima Observer. Arguments should be specified as key-value pairs. Other then the following arguments, those specified in Observer also apply.
start_epochis a number identifying the minimum epoch after which Experiments can begin to be persisted to disk. Useful to reduce I/O at beginning of training. Defaults to 5;error_reportis a table specifying a sequence of keys to access variable from epoch reports. Default is{'validator', 'loss', 'avgError'}(for cross-validation), unless of course anerror_channelis specified.error_channelis a string or table specifying the Channel to subscribe to for early stopping. Should return an error value and the last experiment report. Over-rideserror_reportwhen specified.maximizeis a boolean having a default value of false. When true, the error channel or report is negated. This is useful when the channel returns a measure like accuracy that should be maximized, instead of an error that should be minimized.notifyis a boolean. When true (the default), notifies listeners (Subscribers) when a new minima is found.
EarlyStopper
An ErrorMinima instance that saves the version of
the subject with the lowest error and terminates
the experiment when no new minima is found for max_epochs.
Should only be called on Experiment, Propagator or Model subjects.
Error can be obtained from experiment report or mediator Channel.
If obtained from experiment report via error_report, subscribes to doneEpoch channel.
dp.EarlyStopper{...}
Constructs an EarlyStopper Observer. Arguments should be specified as key-value pairs. Other then the following arguments, those specified in ErrorMinima also apply.
save_strategyis an object with asave(subject)method for persisting the subject to disk. Defaults todp.SaveToFile()max_epochsspecifies the maximum number of epochs to consider after a minima has been found. After that, a terminate signal is published to the mediator. Defaults to 30.max_erroris the maximum value for which the experiment should be stopped aftermin_epochepochs. Ifmaximize=truethis is minimum value. A value of 0 (the default) means that it is ignored.min_epochis a number having a default value of 1000000. Seemax_valuefor a description.
AdaptiveDecay
An Observer that decays learning rate by decay_factor when validation error doesn't reach a new
minima for max_wait epochs. This object should observe in conjuction with an
ErrorMinima instance, such as EarlyStopper.
As example, suppose the object is initialized with decay_factor=0.5
and max_wait=1, while the subject is initialized with learning_rate=10.
If the sequence of errors is
10, 9, 8, 8, 8, 8, 9, 7, 7, 8
then the corresponding sequence of learning rates given these errors would be
10, 10, 10, 10, 1, 1, 0.1, 0.1, 0.1, 0.01
dp.AdaptiveDecay{...}
Constructs an AdaptiveDecay Observer. Arguments should be specified as key-value pairs. Other then the following arguments, those specified in Observer also apply.
max_waitspecifies the maximum number of epochs to wait for a new minima to be found. After that, the learning rate is decayed bydecay_factor. Defaults to 2.decay_factorspecifies the factor by which learning ratelris decayed as per :lr = lr*decay_factor.