classias::train::lbfgs_logistic_binary< data_tmpl, model_tmpl > Class Template Reference

Inheritance diagram for classias::train::lbfgs_logistic_binary< data_tmpl, model_tmpl >:

classias::train::lbfgs_base< model_tmpl >

Detailed Description

template<class data_tmpl, class model_tmpl = weight_vector>
class classias::train::lbfgs_logistic_binary< data_tmpl, model_tmpl >

Gradient descent with L-BFGS for binary classification.

Parameters:
data_tmpl The type of the data set for training.
model_tmpl The type of the feature weights.


Public Types

typedef data_tmpl data_type
 A type representing a data set for training.
typedef model_tmpl model_type
 The type implementing a model (weight vector for features).
typedef lbfgs_base< model_tmpl > base_class
 A synonym of the base class.
typedef lbfgs_logistic_binary<
data_tmpl, model_tmpl > 
this_class
 A synonym of this class.
typedef model_type::value_type value_type
 The type representing a value.
typedef data_type::instance_type instance_type
 A type representing an instance in the training data.
typedef data_type::const_iterator const_iterator
 A type providing a read-only random-access iterator for instances.
typedef instance_type::features_type features_type
 A type representing a vector of features.
typedef features_type::identifier_type feature_identifier_type
 A type representing a feature identifier.
typedef classify::linear_binary_logistic<
model_type
error_type
 A classifier type.

Public Member Functions

 lbfgs_logistic_binary ()
 Constructs the object.
virtual ~lbfgs_logistic_binary ()
 Destructs the object.
void clear ()
 Resets the internal states and parameters to default.
void train (const data_type &data, std::ostream &os, int holdout=-1, bool acconly=true)
 Trains a model on a data set.

Protected Member Functions

virtual value_type loss_and_gradient (const value_type *x, value_type *g, const int n)
 Computes the loss and gradients of the data set.
void holdout_evaluation ()
 Performs a holdout evaluation.

Protected Attributes

const data_typem_data
 A data set for training.


Member Function Documentation

template<class data_tmpl, class model_tmpl = weight_vector>
virtual value_type classias::train::lbfgs_logistic_binary< data_tmpl, model_tmpl >::loss_and_gradient ( const value_type x,
value_type g,
const int  n 
) [inline, protected, virtual]

Computes the loss and gradients of the data set.

Parameters:
x The current feature weights.
g The gradient vector to which this function stores.
n The number of features.
Returns:
value_type The loss of the data set on the current weights.

Implements classias::train::lbfgs_base< model_tmpl >.

template<class data_tmpl, class model_tmpl = weight_vector>
void classias::train::lbfgs_logistic_binary< data_tmpl, model_tmpl >::train ( const data_type data,
std::ostream &  os,
int  holdout = -1,
bool  acconly = true 
) [inline]

Trains a model on a data set.

Parameters:
data The data set for training (and holdout evaluation).
os The output stream for progress reports.
holdout The group number for holdout evaluation. Specify a negative value if a holdout evaluation is unnecessary.
acconly Unused (reserved only for the compatibility with multi-class classification).


Copyright (c) 2002-2009 by Naoaki Okazaki
Mon Dec 28 23:41:07 2009