Regularise the parameters using L1 regularisation
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(l1_regulariser_type), | intent(in) | :: | this |
Instance of the L1 regulariser |
||
| real(kind=real32), | intent(in), | dimension(:) | :: | params |
Parameters to regularise |
|
| real(kind=real32), | intent(inout), | dimension(:) | :: | gradient |
Gradient of the parameters |
|
| real(kind=real32), | intent(in) | :: | learning_rate |
Learning rate |
pure subroutine regularise_l1(this, params, gradient, learning_rate) !! Regularise the parameters using L1 regularisation implicit none ! Arguments class(l1_regulariser_type), intent(in) :: this !! Instance of the L1 regulariser real(real32), dimension(:), intent(in) :: params !! Parameters to regularise real(real32), dimension(:), intent(inout) :: gradient !! Gradient of the parameters real(real32), intent(in) :: learning_rate !! Learning rate gradient = gradient + learning_rate * this%l1 * sign(1._real32,params) end subroutine regularise_l1