classias::train::online_scheduler_multi< data_tmpl, trainer_tmpl > Class Template Reference


Detailed Description

template<class data_tmpl, class trainer_tmpl>
class classias::train::online_scheduler_multi< data_tmpl, trainer_tmpl >

A scheduler of online algorithms for training multi/candidate classifiers.

This is a utility class to use online training algorithms from a data set transparently as a batch training algorithm.

Parameters:
data_tmpl The type of a data set.
trainer_tmpl The type of an online training algorithm.


Public Types

typedef data_tmpl data_type
 The type representing a data set for training.
typedef trainer_tmpl trainer_type
 The type implementing a training algorithm.
typedef data_type::const_iterator const_iterator
 A type providing a read-only random-access iterator for instances.
typedef data_type::instance_type instance_type
 The type representing an instance in the training data.
typedef data_type::attribute_type attribute_type
 The type representing an attribute in an instance.
typedef instance_type::value_type value_type
 The type representing a value.
typedef trainer_type::error_type error_type
 The type implementing an error function.
typedef trainer_type::model_type model_type
 The type implementing a model (weight vector for features).

Public Member Functions

 online_scheduler_multi ()
 Constructs the object.
virtual ~online_scheduler_multi ()
 Destructs the object.
void clear ()
 Resets the internal states and parameters to default.
parameter_exchangeparams ()
 Obtains the parameter interface.
const model_typemodel () const
 Obtains a read-only access to the weight vector (model).
void train (const data_type &data, std::ostream &os, int holdout=-1, bool acconly=true)
 Trains a model on a data set.

Protected Attributes

trainer_type m_trainer
 Trainer type.
std::string m_sample
 The sample method.
int m_max_iterations
 The maximum number of iterations.
value_type m_c
 The parameter for regularization.
int m_period
 The period to measure the improvement ratio of loss.
value_type m_epsilon
 The epsilon for improvement ratio.


Member Function Documentation

template<class data_tmpl, class trainer_tmpl>
parameter_exchange& classias::train::online_scheduler_multi< data_tmpl, trainer_tmpl >::params (  )  [inline]

Obtains the parameter interface.

Returns:
parameter_exchange& The parameter interface associated with this algorithm.

template<class data_tmpl, class trainer_tmpl>
const model_type& classias::train::online_scheduler_multi< data_tmpl, trainer_tmpl >::model (  )  const [inline]

Obtains a read-only access to the weight vector (model).

Returns:
const model_type& The weight vector (model).

template<class data_tmpl, class trainer_tmpl>
void classias::train::online_scheduler_multi< data_tmpl, trainer_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 The flag indicating whether precision, recall, and F1 scores are unnecessary.


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