Turi Create  4.0
turi::optimization::l2_norm Class Reference

#include <ml/optimization/regularizers-inl.hpp>

Public Member Functions

 l2_norm (const DenseVector &_lambda)
 
 ~l2_norm ()
 
void compute_hessian (const DenseVector &point, DiagonalMatrix &hessian) const
 
double compute_function_value (const DenseVector &point) const
 
void compute_gradient (const DenseVector &point, DenseVector &gradient) const
 
void apply_proximal_operator (DenseVector &point, const double &_penalty=0) const
 
bool is_smooth ()
 

Protected Attributes

DenseVector lambda
 
size_t variables
 

Detailed Description

Interface for the regularizer (Scaled L2-norm)

 f(x) = \sum_{i} lambda_i * x_i^2

Definition at line 42 of file regularizers-inl.hpp.

Constructor & Destructor Documentation

◆ l2_norm()

turi::optimization::l2_norm::l2_norm ( const DenseVector &  _lambda)
inline

Default constructor.

Definition at line 55 of file regularizers-inl.hpp.

◆ ~l2_norm()

turi::optimization::l2_norm::~l2_norm ( )
inline

Default desctuctor. Do nothing.

Definition at line 63 of file regularizers-inl.hpp.

Member Function Documentation

◆ apply_proximal_operator()

void turi::optimization::l2_norm::apply_proximal_operator ( DenseVector &  point,
const double &  _penalty = 0 
) const
inlinevirtual

Compute the proximal operator for the l2-regularizer

Parameters
[in,out]pointPoint at which we are computing the gradient.
[in]penaltyPenalty
Note
The proximal operator for lambda * ||x||^2 at the point v is given by v/(1 + 2*lambda*penalty)

Implements turi::optimization::regularizer_interface.

Definition at line 112 of file regularizers-inl.hpp.

◆ compute_function_value()

double turi::optimization::l2_norm::compute_function_value ( const DenseVector &  point) const
inlinevirtual

Compute the function value of the regularizer at a given point.

Parameters
[in]pointPoint at which we are computing the gradient.

Implements turi::optimization::regularizer_interface.

Definition at line 82 of file regularizers-inl.hpp.

◆ compute_gradient()

void turi::optimization::l2_norm::compute_gradient ( const DenseVector &  point,
DenseVector &  gradient 
) const
inlinevirtual

Compute the gradient (or subgradient) at the given point.

Parameters
[in]pointPoint at which we are computing the gradient.
[out]gradientDense gradient

Implements turi::optimization::regularizer_interface.

Definition at line 95 of file regularizers-inl.hpp.

◆ compute_hessian()

void turi::optimization::l2_norm::compute_hessian ( const DenseVector &  point,
DiagonalMatrix &  hessian 
) const
inlinevirtual

Compute the hessian of the regularizer at a given point.

Parameters
[in]pointPoint at which we are computing the gradient.
[in,out]hessianDiagonal matrix as the hessian gradient.

Implements turi::optimization::smooth_regularizer_interface.

Definition at line 72 of file regularizers-inl.hpp.

◆ is_smooth()

bool turi::optimization::smooth_regularizer_interface::is_smooth ( )
inlineinherited

Function to determine if the regularizer is smooth.

Returns
true

Definition at line 113 of file regularizer_interface.hpp.

Member Data Documentation

◆ lambda

DenseVector turi::optimization::l2_norm::lambda
protected

Penalty on the regularizer

Definition at line 46 of file regularizers-inl.hpp.

◆ variables

size_t turi::optimization::l2_norm::variables
protected

Variables in the problem

Definition at line 47 of file regularizers-inl.hpp.


The documentation for this class was generated from the following file: