Class MaxNormRegularizer
- Namespace
- NeuralNetworks.Regularization
- Assembly
- NeuralNetworks.dll
Applies max-norm regularization by scaling a parameter vector when its L2 norm exceeds a specified limit.
public class MaxNormRegularizer : BaseRegularizer, IRegularizer
- Inheritance
-
MaxNormRegularizer
- Implements
- Inherited Members
Remarks
If the vector norm is greater than the configured limit, all elements are scaled by the same factor so the resulting norm equals the limit.
Constructors
MaxNormRegularizer(float)
public MaxNormRegularizer(float maxNorm)
Parameters
maxNormfloatThe maximum allowed L2 norm for the parameter vector.
Methods
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
UpdateParamsCore(Span<float>)
Scales the parameter vector in place when its Euclidean norm exceeds the configured maximum norm.
protected override void UpdateParamsCore(Span<float> paramSpan)
Parameters
Remarks
Computes the L2 norm of the span and applies a uniform scaling factor so the resulting norm equals the maximum norm while preserving the vector direction.