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

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

Public Member Functions

 elastic_net (const DenseVector &_alpha, const DenseVector &_beta)
 
 ~elastic_net ()
 
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 alpha
 
DenseVector beta
 
size_t variables
 

Detailed Description

Interface for the elastic net regularizer (Scaled L1-norm)

 f(x) = \sum_{i} alpha_i * |x_i| + \sum_{i} beta_i * x_i^2

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

Constructor & Destructor Documentation

◆ elastic_net()

turi::optimization::elastic_net::elastic_net ( const DenseVector &  _alpha,
const DenseVector &  _beta 
)
inline

Default constructor.

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

◆ ~elastic_net()

turi::optimization::elastic_net::~elastic_net ( )
inline

Default desctuctor. Do nothing.

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

Member Function Documentation

◆ apply_proximal_operator()

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

Compute the proximal operator for the elastic-regularizer

Parameters
[in,out]pointPoint at which we are computing the gradient.
[in]penaltyPenalty
Note
The proximal operator for alpha||x||_1 + beta||x||_2^2 at y = soft(x, alpha) = (x - alpha)_+ - (-x - alpha)_+ x = y / (1 + 2 beta)
Do not swap the order.

Implements turi::optimization::regularizer_interface.

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

◆ compute_function_value()

double turi::optimization::elastic_net::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 241 of file regularizers-inl.hpp.

◆ compute_gradient()

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

Compute the subgradient at the given point.

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

Implements turi::optimization::regularizer_interface.

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

◆ is_smooth()

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

Function to determine if the regularizer is smooth.

Returns
false

Definition at line 56 of file regularizer_interface.hpp.

Member Data Documentation

◆ alpha

DenseVector turi::optimization::elastic_net::alpha
protected

Penalty on the l1-regularizer

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

◆ beta

DenseVector turi::optimization::elastic_net::beta
protected

Penalty on the l2-regularizer

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

◆ variables

size_t turi::optimization::elastic_net::variables
protected

Variables in the problem

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


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