dcase_framework.keras_utils.StasherCallback¶
-
class
dcase_framework.keras_utils.
StasherCallback
(*args, **kwargs)[source]¶ Keras callback to monitor training process and store best model. Implements Keras Callback API.
This callback is very similar to standard
ModelCheckpoint
Keras callback, however it adds support for external metrics (metrics calculated outside Keras training process).Constructor
Parameters: epochs : int
Total amount of epochs
manual_update : bool
Manually update callback, use this to when injecting external metrics Default value True
monitor : str
Metric to monitor Default value ‘val_loss’
mode : str
Which way metric is interpreted, values {auto, min, max} Default value ‘auto’
period : int
Disable tqdm based progress bar Default value 1
initial_delay : int
Amount of epochs to wait at the beginning before quantity is monitored. Default value 10
save_weights : bool
Save weight to the disk Default value False
file_path : str
File name for model weight Default value None
-
__init__
(*args, **kwargs)[source]¶ Constructor
Parameters: epochs : int
Total amount of epochs
manual_update : bool
Manually update callback, use this to when injecting external metrics Default value True
monitor : str
Metric to monitor Default value ‘val_loss’
mode : str
Which way metric is interpreted, values {auto, min, max} Default value ‘auto’
period : int
Disable tqdm based progress bar Default value 1
initial_delay : int
Amount of epochs to wait at the beginning before quantity is monitored. Default value 10
save_weights : bool
Save weight to the disk Default value False
file_path : str
File name for model weight Default value None
Methods
__init__
(\*args, \*\*kwargs)Constructor add_external_metric
(metric_label)get_best
()Return best model seen get_operator
(metric)log
()Print information about the best model into logging interface on_batch_begin
(batch[, logs])on_batch_end
(batch[, logs])on_epoch_begin
(epoch[, logs])on_epoch_end
(epoch[, logs])on_train_begin
([logs])on_train_end
([logs])set_external_metric_value
(metric_label, ...)Add external metric value set_model
(model)set_params
(params)update
()-