Regularizer#

class usencrypt.ai.regularizers.Regularizer#

Base class for regularizers.

Regularizer objects introduce penalties to a model’s cost function. This is done by applying them on desired layers using their weight_regularizer and/or bias_regularizer arguments.

Note

This is a base class and it is not intended to be called directly. Users are expected to instantiate each of its subclasses directly.

Available regularizers

Examples

In the case of L2 regularization, the penalty can be passed into supported layers (e.g., usencrypt.ai.nn.layers.FCLayer) as either a weight_regularizer or bias_regularizer argument, as follows:

>>> import usencrypt as ue
>>> l2_reg = ue.ai.regularizers.L2()
>>> layer = ue.ai.nn.layers.FCLayer(3, 4, weight_regularizer=l2_reg)