mlpack 3.4.2
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
18namespace mlpack {
19namespace ann {
20
26template<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 unsigned int /* 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.
double factor
The constant for the regularization.
void Evaluate(const MatType &weight, MatType &gradient)
Calculate the gradient for regularization.
static const int Power
The power of the regularizer.
void serialize(Archive &ar, const unsigned int)
Serialize the regularizer (nothing to do).
LRegularizer(double factor=1.0)
Create the regularizer object.
LRegularizer< 1 > L1Regularizer
The L1 Regularizer.
LRegularizer< 2 > L2Regularizer
The L2 Regularizer.
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
The core includes that mlpack expects; standard C++ includes and Armadillo.