Inheritance diagram for classias::train::lbfgs_base< model_tmpl >:
This class implements internal variables, operations, and interface that are common for training a binary/multi classification.
model_tmpl | The type of a weight vector for features. |
Public Types | |
typedef model_tmpl | model_type |
The type implementing a model (weight vector for features). | |
typedef model_type::value_type | value_type |
The type representing a value. | |
typedef lbfgs_base< model_tmpl > | this_class |
A synonym of this class. | |
Public Member Functions | |
lbfgs_base () | |
Constructs the object. | |
virtual | ~lbfgs_base () |
Destructs the object. | |
void | clear () |
Resets the internal states and parameters to default. | |
parameter_exchange & | params () |
Obtains the parameter interface. | |
const model_type & | model () const |
Obtains a read-only access to the weight vector (model). | |
Protected Member Functions | |
void | initialize_weights (const size_t K) |
Initializes the weight vector of the size K. | |
value_type | lbfgs_evaluate (const value_type *x, value_type *g, const int n, const value_type step) |
int | lbfgs_progress (const value_type *x, const value_type *g, const value_type fx, const value_type xnorm, const value_type gnorm, const value_type step, int n, int k, int ls) |
int | lbfgs_solve (const int K, std::ostream &os, int holdout, int regularization_start) |
void | lbfgs_output_status (std::ostream &os, int status) |
virtual value_type | loss_and_gradient (const value_type *x, value_type *g, const int n)=0 |
virtual void | holdout_evaluation ()=0 |
Static Protected Member Functions | |
static value_type | __lbfgs_evaluate (void *inst, const value_type *x, value_type *g, const int n, const value_type step) |
static int | __lbfgs_progress (void *inst, const double *x, const double *g, const double fx, const double xnorm, const double gnorm, const double step, int n, int k, int ls) |
Protected Attributes | |
model_type | m_w |
The array of feature weights. | |
parameter_exchange | m_params |
Parameter interface. | |
value_type | m_c1 |
Coefficient for L1-regularization;. | |
value_type | m_c2 |
Coefficient for L2-regularization. | |
int | m_lbfgs_num_memories |
The number of memories in L-BFGS. | |
value_type | m_lbfgs_epsilon |
L-BFGS epsilon for convergence. | |
int | m_lbfgs_stop |
Number of iterations for stopping criterion. | |
value_type | m_lbfgs_delta |
The delta threshold for stopping criterion. | |
int | m_lbfgs_maxiter |
Maximum number of L-BFGS iterations. | |
std::string | m_lbfgs_linesearch |
Line search algorithm. | |
int | m_lbfgs_max_linesearch |
The maximum number of trials for the line search algorithm. | |
int | m_holdout |
A group number for holdout evaluation. | |
std::ostream * | m_os |
An output stream to which this object outputs log messages. | |
clock_t | m_clk_prev |
An internal variable (previous timestamp). | |
int | m_regularization_start |
The start index for regularization. |
void classias::train::lbfgs_base< model_tmpl >::initialize_weights | ( | const size_t | K | ) | [inline, protected] |
Initializes the weight vector of the size K.
This function prepares a vector of the size K, and sets W = 0.
K | The size of the weight vector. |
parameter_exchange& classias::train::lbfgs_base< model_tmpl >::params | ( | ) | [inline] |
Obtains the parameter interface.
const model_type& classias::train::lbfgs_base< model_tmpl >::model | ( | ) | const [inline] |
Obtains a read-only access to the weight vector (model).