yamle.regularizers.regularizer module#
- class yamle.regularizers.regularizer.BaseRegularizer[source]#
Bases:
ABCThis is a general class for regularizers applied to the model (L1, L2, etc.).
- get_parameters(model)[source]#
This method is used to get the parameters of the model that should be regularized.
- Return type:
List[Parameter]
- get_names(model)[source]#
This method is used to get the names of the parameters of the model that should and should not be regularized.
- Return type:
Tuple[List[str],List[str]]
- on_after_training_step(model, *args, **kwargs)[source]#
This method is used to update the model after a given training step.
It can be used to implement a weight decay strategy, e.g. update the weights after each training batch by decaying them with a given factor multiplied by the learning rate.
- Return type:
None
- on_after_backward(model, *args, **kwargs)[source]#
This method is used to update the model after the backward pass.
It can be used to update the model after the backward pass, e.g. add noise to the gradients.
- Return type:
None
- class yamle.regularizers.regularizer.DummyRegularizer[source]#
Bases:
BaseRegularizerThis is a class for a dummy regularizer that does nothing.