Ridge#

class vulkpy.nn.Ridge#

Bases: Regularizer

Ridge (L2) Regularization

Notes

\[\begin{split}L = \text{coeff} \times \sum_i |W_i|^2\\ dL/dW_i = 2 \cdot \text{coeff} \times W_i\end{split}\]

Methods Summary

grad(param)

Gradient of L2 Regularization Loss

loss(param)

L2 Regularization Loss

Methods Documentation

grad(param: Array) Array#

Gradient of L2 Regularization Loss

Parameters:

param (vulkpy.Array) – Parameter

Returns:

dW – Gradient for L2 Regularization Loss

Return type:

vulkpy.Array

loss(param: Array) Array#

L2 Regularization Loss

Parameters:

param (vulkpy.Array) – Parameter

Returns:

loss – L2 Regularization Loss

Return type:

vulkpy.Array

__init__(coeff: float = 1.0)#

Initialize Ridge Regularizer

Parameters:

coef (float, optional) – L2 Coefficient