Class: DNN::Callbacks::EarlyStopping
- Defined in:
- lib/dnn/core/callbacks.rb
Overview
A callback to stop training the model early after test on batch.
Instance Attribute Summary
Attributes inherited from Callback
Instance Method Summary collapse
- #after_epoch ⇒ Object
- #after_train_on_batch ⇒ Object
-
#initialize(trigger, tolerance) ⇒ EarlyStopping
constructor
A new instance of EarlyStopping.
Constructor Details
#initialize(trigger, tolerance) ⇒ EarlyStopping
Returns a new instance of EarlyStopping.
63 64 65 66 |
# File 'lib/dnn/core/callbacks.rb', line 63 def initialize(trigger, tolerance) @trigger = trigger @tolerance = tolerance end |
Instance Method Details
#after_epoch ⇒ Object
72 73 74 |
# File 'lib/dnn/core/callbacks.rb', line 72 def after_epoch throw :stop, "Early stopped." if judge_early_stopping_test end |
#after_train_on_batch ⇒ Object
68 69 70 |
# File 'lib/dnn/core/callbacks.rb', line 68 def after_train_on_batch throw :stop, "Early stopped." if judge_early_stopping_train end |