Lasso#

class vulkpy.nn.Lasso#

Bases: Regularizer

Lasso (L1) Regularization

Notes

\[\begin{split}L = \text{coeff} \times \sum_i |W_i|\\ dL/dW_i = \text{coeff} \times \rm{sign}(W_i)\end{split}\]

Methods Summary

grad(param)

Gradient of L1 Regularization Loss

loss(param)

L1 Regularization Loss

Methods Documentation

grad(param: Array) Array#

Gradient of L1 Regularization Loss

Parameters:

param (vulkpy.Array) – Parameter

Returns:

dW – Gradient for L1 Regularization Loss

Return type:

vulkpy.Array

loss(param: Array) Array#

L1 Regularization Loss

Parameters:

param (vulkpy.Array) – Parameter

Returns:

loss – L1 Regularization Loss

Return type:

vulkpy.Array

__init__(coeff: float = 1.0)#

Initialize Lasso Regularizer

Parameters:

coeff (float, optional) – L1 Coefficient