Elastic#

class vulkpy.nn.Elastic#

Bases: Regularizer

Elastic (L1 + L2) Regularization

Notes

\[\begin{split}L = \alpha \sum _i |W_i| + \beta \sum _i |W_i|^2\\ dL/dW_i = \alpha \rm{sign}(W_i) + 2 \beta W_i\end{split}\]

Methods Summary

grad(param)

Gradient of L1 + L2 Regularization Loss

loss(param)

L1 + L2 Regularization Loss

Methods Documentation

grad(param: Array) Array#

Gradient of L1 + L2 Regularization Loss

Parameters:

param (vulkpy.Array) – Parameter

Returns:

dW – Gradient for L1 + L2 Regularization Loss

Return type:

vulkpy.Array

loss(param: Array) Array#

L1 + L2 Regularization Loss

Parameters:

param (vulkpy.Array) – Parameter

Returns:

loss – L1 + L2 Regularization Loss

Return type:

vulkpy.Array

__init__(L1: float = 1.0, L2: float = 1.0)#

Initialize Elastic Regularizer

Parameters:
  • L1 (float, optional) – L1 Coefficient

  • L2 (float, optional) – L2 Coefficient