libeblearn
ebl::class_answer< T, Tds1, Tds2, Tstate > Class Template Reference

#include <ebl_answer.h>

Inheritance diagram for ebl::class_answer< T, Tds1, Tds2, Tstate >:
ebl::answer_module< T, Tds1, Tds2, Tstate > ebl::module_1_1< T, Tstate > ebl::module ebl::scalerclass_answer< T, Tds1, Tds2, Tstate > ebl::vote_answer< T, Tds1, Tds2, Tstate >

List of all members.

Public Member Functions

 class_answer (uint nclasses, double target_factor=1.0, bool binary_target=false, t_confidence conf=confidence_max, bool apply_tanh=false, const char *name="class_answer", int force_class=-1)
virtual void fprop (Tstate &in, Tstate &out)
virtual void fprop (labeled_datasource< T, Tds1, Tds2 > &ds, Tstate &out)
 Produce target matrix into 'out' for training, given a datasource 'ds'.
virtual bool correct (Tstate &answer, Tstate &label)
 Returns true if 'answer' matches with 'label'.
virtual void update_log (classifier_meter &log, intg age, idx< T > &energy, idx< T > &answer, idx< T > &label, idx< T > &target, idx< T > &rawout)
 Update the 'log' according to this type of answer module.
virtual std::string describe ()
 Returns a string describing this module and its parameters.

Protected Attributes

idx< T > targets
 The targets for training.
idx< T > target
 Temporary buffer for 1 target.
t_confidence conf_type
 The confidence type.
conf_ratio
 Ratio to normalize confidence to 1.
conf_shift
 to be subtracted before div conf_ratio
bool binary_target
 Target is binary or not.
bool resize_output
 Resize output or not.
bool apply_tanh
 If true, apply tanh to inputs.
Tstate tmp
 Temporary buffer.
bbstate_idx< Tds2 > last_label
 Last label set by fprop.
tanh_module< T, Tstate > mtanh
 A tanh module.
target_min
target_max
int force_class

Detailed Description

template<typename T, typename Tds1 = T, typename Tds2 = T, class Tstate = bbstate_idx<T>>
class ebl::class_answer< T, Tds1, Tds2, Tstate >

This module gathers information from a labeled_datasource 'ds' and outputs a state of type 'Tstate'. The output state is a 1-of-n target vector given the discret label of the sample.


Constructor & Destructor Documentation

template<typename T , typename Tds1 , typename Tds2 , class Tstate >
ebl::class_answer< T, Tds1, Tds2, Tstate >::class_answer ( uint  nclasses,
double  target_factor = 1.0,
bool  binary_target = false,
t_confidence  conf = confidence_max,
bool  apply_tanh = false,
const char *  name = "class_answer< T, Tds1, Tds2, Tstate >",
int  force_class = -1 
)

Initialize target vectors given the number of classes.

Parameters:
nclassesThe number of classes for classification.
target_factorA factor applied to targets.
binary_targetIf true, target is a scalar with -1 or 1.
confThe type of confidence.
apply_tanhIf true, a tanh is applied to inputs.
force_classIf >= 0, force answers to this class.

Member Function Documentation

template<typename T , typename Tds1 , typename Tds2 , class Tstate >
void ebl::class_answer< T, Tds1, Tds2, Tstate >::fprop ( Tstate &  in,
Tstate &  out 
) [virtual]

Produce a vector of answers given input 'in'. 'out' contains answers in this order: class id and confidence.

Reimplemented from ebl::answer_module< T, Tds1, Tds2, Tstate >.

Reimplemented in ebl::scalerclass_answer< T, Tds1, Tds2, Tstate >, and ebl::vote_answer< T, Tds1, Tds2, Tstate >.


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