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
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:
- loss(param: Array) Array #
L1 + L2 Regularization Loss
- Parameters:
param (vulkpy.Array) – Parameter
- Returns:
loss – L1 + L2 Regularization Loss
- Return type:
- __init__(L1: float = 1.0, L2: float = 1.0)#
Initialize Elastic Regularizer
- Parameters:
L1 (float, optional) – L1 Coefficient
L2 (float, optional) – L2 Coefficient