Skip to content

Commit

Permalink
Fix L1 regularization in case where weight is zero (#3545)
Browse files Browse the repository at this point in the history
  • Loading branch information
akropp committed Oct 21, 2023
1 parent bba07a3 commit ae354c8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
###### ????-??-??
* Fix include ordering issue for `LinearRegression` (#3541).

* Fix L1 regularization in case where weight is zero (#3545).

### mlpack 4.2.1
###### 2023-09-05
* Reinforcement Learning: Gaussian noise (#3515).
Expand Down
2 changes: 1 addition & 1 deletion src/mlpack/methods/ann/regularizer/lregularizer_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ template<>
template<typename MatType>
void LRegularizer<1>::Evaluate(const MatType& weight, MatType& gradient)
{
gradient += arma::vectorise(factor * weight / arma::abs(weight));
gradient += arma::vectorise(factor * arma::sign(weight));
}

// L2-Regularizer specializations.
Expand Down

0 comments on commit ae354c8

Please sign in to comment.