libeblearn
|
#include <ebl_answer.h>
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. | |
T | conf_ratio |
Ratio to normalize confidence to 1. | |
T | 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. | |
T | target_min |
T | target_max |
int | force_class |
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.
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.
nclasses | The number of classes for classification. |
target_factor | A factor applied to targets. |
binary_target | If true, target is a scalar with -1 or 1. |
conf | The type of confidence. |
apply_tanh | If true, a tanh is applied to inputs. |
force_class | If >= 0, force answers to this class. |
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 >.