Callback
- class hybrid_learning.concepts.train_eval.callbacks.Callback(*args, **kwds)[source]
Bases:
Mapping
A callback base class that eases implementing a custom callback handle.
A callback handle simply is a mapping of
CallbackEvents
to callback functions. One callback can define several pairs of event and callback function. A callback function is any function that can be called viacallback_fun(**callback_context)
, wherecallback_context
is a mapping of key-value pairs. The correct callback function for a given event and callback context can be called usingrun_callbacks()
.To add a callback function to an implementation of this class, just implement it as method with the same name as the callback event’s value. Make sure to add a **_ catch-all argument to each defined callback function to allow ignoring unused key-value pairs from the callback context.
Public Methods:
keys
()Collect a list of all supported callback events.
Inherited from : py: class:Mapping
get
(k[,d])keys
()Collect a list of all supported callback events.
items
()values
()Special Methods:
__getitem__
(event)Get the method for the specified event or a pass lambda.
__len__
()Number of mapped events.
__iter__
()Iterate over mapped events.
Inherited from : py: class:Mapping
__getitem__
(event)Get the method for the specified event or a pass lambda.
__contains__
(key)__eq__
(other)Return self==value.
Inherited from : py: class:Sized
__len__
()Number of mapped events.
Inherited from : py: class:Iterable
__iter__
()Iterate over mapped events.
Inherited from : py: class:Container
__contains__
(key)
- __getitem__(event)[source]
Get the method for the specified event or a pass lambda.
- Parameters
event (CallbackEvents) –
- static to_descriptor(log_prefix=None, run=None, epoch=None, batch=None)[source]
Merge logging information into file name descriptor.
log_dir
is prepended as path, the rest is merged with_
.
- __orig_bases__ = (typing.Mapping,)
- __parameters__ = ()