Class L3Regularizer
- Namespace
- NeuralNetworks.Regularization
- Assembly
- NeuralNetworks.dll
Applies L3 regularization by adding a penalty proportional to the cubed magnitude of model parameters.
public class L3Regularizer : BaseRegularizer, IRegularizer
- Inheritance
-
L3Regularizer
- Implements
- Inherited Members
Remarks
Uses the L3 penalty form l3 * Σ(|w|^3), contributes 3 * l3 * w * |w| to each parameter gradient, and can optionally include the penalty term in the reported loss via the base regularizer configuration.
Constructors
L3Regularizer(float, bool)
public L3Regularizer(float l3, bool reportPenaltyInLoss = false)
Parameters
Methods
ApplyGradientCore(ReadOnlySpan<float>, Span<float>)
Applies a gradient update to the specified parameter span using the corresponding gradient span.
protected override void ApplyGradientCore(ReadOnlySpan<float> paramSpan, Span<float> paramGradientSpan)
Parameters
paramSpanReadOnlySpan<float>The span of parameter values to update.
paramGradientSpanSpan<float>The span of gradient values corresponding to
paramSpan.
CalculatePenaltyCore(ReadOnlySpan<float>)
protected override float CalculatePenaltyCore(ReadOnlySpan<float> paramSpan)
Parameters
paramSpanReadOnlySpan<float>
Returns
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.