6 #ifndef TURI_REGULARIZER_H_ 7 #define TURI_REGULARIZER_H_ 10 #include <core/data/flexible_type/flexible_type.hpp> 14 #include <Eigen/SparseCore> 17 #include <ml/optimization/optimization_interface.hpp> 18 #include <ml/optimization/regularizer_interface.hpp> 26 namespace optimization {
57 variables = _lambda.size();
74 hessian = 2 * lambda.asDiagonal();
83 DASSERT_EQ(variables, point.size());
84 return lambda.dot(point.cwiseAbs2());
97 DASSERT_EQ(variables, point.size());
98 gradient = 2 * lambda.cwiseProduct(point);
114 DASSERT_EQ(variables, point.size());
116 point[i] = point[i] / (1 + 2*_penalty*lambda[i]);
143 variables = _lambda.size();
158 DASSERT_EQ(variables, point.size());
159 return lambda.dot(point.cwiseAbs());
171 DASSERT_EQ(variables, point.size());
175 gradient[i] = lambda[i];
177 gradient[i] = - lambda[i];
193 DASSERT_EQ(variables, point.size());
195 point[i] = std::max(point[i] - _penalty*lambda[i], 0.0) -
196 std::max(-point[i] - _penalty*lambda[i], 0.0);
224 DASSERT_EQ(_alpha.size(), _beta.size());
227 variables = _alpha.size();
242 DASSERT_EQ(variables, point.size());
243 return alpha.dot(point.cwiseAbs()) + beta.dot(point.cwiseAbs2());
255 DASSERT_EQ(variables, point.size());
256 gradient = 2 * beta.cwiseProduct(point);
259 gradient[i] += alpha[i];
261 gradient[i] += -alpha[i];
279 DASSERT_EQ(variables, point.size());
281 point[i] = std::max(point[i] - _penalty*alpha[i], 0.0) -
282 std::max(-point[i] - _penalty*alpha[i], 0.0);
283 point[i] = point[i] / (1 + 2*_penalty*beta[i]);
void apply_proximal_operator(DenseVector &point, const double &_penalty=0) const
void apply_proximal_operator(DenseVector &point, const double &_penalty=0) const
l1_norm(const DenseVector &_lambda)
const double OPTIMIZATION_ZERO
Optimization method zero.
void compute_gradient(const DenseVector &point, DenseVector &gradient) const
void apply_proximal_operator(DenseVector &point, const double &_penalty=0) const
elastic_net(const DenseVector &_alpha, const DenseVector &_beta)
double compute_function_value(const DenseVector &point) const
void compute_gradient(const DenseVector &point, DenseVector &gradient) const
double compute_function_value(const DenseVector &point) const
l2_norm(const DenseVector &_lambda)
double compute_function_value(const DenseVector &point) const
void compute_gradient(const DenseVector &point, DenseVector &gradient) const
void compute_hessian(const DenseVector &point, DiagonalMatrix &hessian) const