12 #ifndef MLPACK_METHODS_ANN_LREGULARIZER_IMPL_HPP 13 #define MLPACK_METHODS_ANN_LREGULARIZER_IMPL_HPP 30 template<
typename MatType>
38 template<
typename MatType>
41 gradient += arma::vectorise(
factor * weight / arma::abs(weight));
46 template<
typename MatType>
49 gradient += arma::vectorise(2 *
factor * weight);
53 template<
typename Archive>
55 Archive& ar,
const uint32_t )
double factor
The constant for the regularization.
Definition: lregularizer.hpp:55
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
LRegularizer(double factor=1.0)
Create the regularizer object.
Definition: lregularizer_impl.hpp:22
static const int Power
The power of the regularizer.
Definition: lregularizer.hpp:52
void Evaluate(const MatType &weight, MatType &gradient)
Calculate the gradient for regularization.
Definition: lregularizer_impl.hpp:31
void serialize(Archive &ar, const uint32_t)
Serialize the regularizer (nothing to do).
Definition: lregularizer_impl.hpp:54