Shortcuts

Source code for lumin.nn.callbacks.callback

from .abs_callback import AbsCallback
from ..models.abs_model import AbsModel
from ...plotting.plot_settings import PlotSettings

__all__ = ['Callback']


[docs]class Callback(AbsCallback): r''' Base callback class from which other callbacks should inherit. ''' def __init__(self): self.model,self.plot_settings = None,PlotSettings()
[docs] def on_train_begin(self) -> None: if self.model is None: raise AttributeError(f"The model for {type(self).__name__} callback has not been set. Please call set_model before on_train_begin.")
[docs] def set_model(self, model:AbsModel) -> None: r''' Sets the callback's model in order to allow the callback to access and adjust model parameters Arguments: model: model to refer to during training ''' self.model = model
[docs] def set_plot_settings(self, plot_settings:PlotSettings) -> None: r''' Sets the plot settings for any plots produced by the callback Arguments: plot_settings: PlotSettings class ''' self.plot_settings = plot_settings
[docs] def on_pred_begin(self) -> None: if self.model is None: raise AttributeError(f"The model for {type(self).__name__} callback has not been set. Please call set_wrapper before on_model_begin.")
Read the Docs v: stable
Versions
latest
stable
v0.8.0
v0.7.2
v0.7.1
v0.7.0
v0.6.0
v0.5.1
v0.5.0
v0.4.0.1
v0.3.1
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.

Docs

Access comprehensive developer and user documentation for LUMIN

View Docs

Tutorials

Get tutorials for beginner and advanced researchers demonstrating many of the features of LUMIN

View Tutorials