lregularizer.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_METHODS_ANN_LREGULARIZER_HPP
14 #define MLPACK_METHODS_ANN_LREGULARIZER_HPP
15 
16 #include <mlpack/prereqs.hpp>
17 
18 namespace mlpack {
19 namespace ann {
20 
26 template<int TPower>
28 {
29  public:
35  LRegularizer(double factor = 1.0);
36 
44  template<typename MatType>
45  void Evaluate(const MatType& weight, MatType& gradient);
46 
48  template<typename Archive>
49  void serialize(Archive& ar, const uint32_t /* version */);
50 
52  static const int Power = TPower;
53 
55  double factor;
56 };
57 
58 // Convenience typedefs.
63 
68 
69 } // namespace ann
70 } // namespace mlpack
71 
72 // Include implementation.
73 #include "lregularizer_impl.hpp"
74 
75 #endif
The L_p regularizer for arbitrary integer p.
Linear algebra utility functions, generally performed on matrices or vectors.
static const int Power
The power of the regularizer.
The core includes that mlpack expects; standard C++ includes and Armadillo.
LRegularizer(double factor=1.0)
Create the regularizer object.
LRegularizer< 2 > L2Regularizer
The L2 Regularizer.
void serialize(Archive &ar, const uint32_t)
Serialize the regularizer (nothing to do).
LRegularizer< 1 > L1Regularizer
The L1 Regularizer.
void Evaluate(const MatType &weight, MatType &gradient)
Calculate the gradient for regularization.
double factor
The constant for the regularization.