classias::train::averaged_perceptron_binary< error_tmpl > Class Template Reference

Inheritance diagram for classias::train::averaged_perceptron_binary< error_tmpl >:

classias::train::averaged_perceptron_base< error_tmpl >

Detailed Description

template<class error_tmpl>
class classias::train::averaged_perceptron_binary< error_tmpl >

Averaged Preceptron for binary classification.

Parameters:
error_tmpl The type of the error (loss) function.


Public Types

typedef error_tmpl error_type
 The type implementing an error function.
typedef error_type::model_type model_type
 The type implementing a model (weight vector for features).
typedef model_type::value_type value_type
 The type representing a value.
typedef averaged_perceptron_base<
error_tmpl > 
base_class
 A synonym of the base class.
typedef averaged_perceptron_binary<
error_tmpl > 
this_class
 A synonym of this class.

Public Member Functions

template<class iterator_type>
void update (iterator_type it)
 Receives a training instance and updates feature weights.
template<class iterator_type>
void update (iterator_type first, iterator_type last)
 Receives multiple training instances and updates feature weights.

Protected Member Functions

template<class iterator_type>
void update_weights (model_type &w, iterator_type first, iterator_type last, value_type delta)
 Adds a value to weights associated with a feature vector.


Member Function Documentation

template<class error_tmpl>
template<class iterator_type>
void classias::train::averaged_perceptron_binary< error_tmpl >::update ( iterator_type  it  )  [inline]

Receives a training instance and updates feature weights.

Parameters:
it An interator for the training instance.
Returns:
value_type The loss computed for the instance.

template<class error_tmpl>
template<class iterator_type>
void classias::train::averaged_perceptron_binary< error_tmpl >::update ( iterator_type  first,
iterator_type  last 
) [inline]

Receives multiple training instances and updates feature weights.

Parameters:
first The iterator pointing to the first instance.
last The iterator pointing just beyond the last instance.
Returns:
value_type The loss computed for the instances.

template<class error_tmpl>
template<class iterator_type>
void classias::train::averaged_perceptron_binary< error_tmpl >::update_weights ( model_type w,
iterator_type  first,
iterator_type  last,
value_type  delta 
) [inline, protected]

Adds a value to weights associated with a feature vector.

Parameters:
w The weight vector to which an update occurs.
first The iterator pointing to the first element of the feature vector.
last The iterator pointing just beyond the last element of the feature vector.
delta The value to be added to the weights.


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