libeblearn
ebl::trainable_module< T, Tds1, Tds2, Tin1, Tin2, Ten > Class Template Reference

#include <ebl_answer.h>

List of all members.

Public Member Functions

 trainable_module (ebm_2< Tin1, Tin2, Ten > &energy, module_1_1< T, Tin1 > &mod1, module_1_1< T, Tin2 > *mod2=NULL, answer_module< T, Tds1, Tds2, Tin1 > *dsmod1=NULL, answer_module< T, Tds1, Tds2, Tin2 > *dsmod2=NULL, const char *name="trainable_module", const char *switcher="")
virtual void fprop (labeled_datasource< T, Tds1, Tds2 > &ds, Ten &energy)
virtual void bprop (labeled_datasource< T, Tds1, Tds2 > &ds, Ten &energy)
virtual void bbprop (labeled_datasource< T, Tds1, Tds2 > &ds, Ten &energy)
virtual int infer2 (labeled_datasource< T, Tds1, Tds2 > &ds, Ten &energy)
virtual void forget (forget_param_linear &fp)
 Randomize internal modules using randomization parameters 'fp'.
virtual const Tin1 & compute_answers ()
virtual void compute_answers (Tin1 &ans)
virtual bool correct (Tin1 &answer, Tin1 &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 the type of answer module.
virtual idx< T > compute_targets (labeled_datasource< T, Tds1, Tds2 > &ds)
virtual const char * name ()
 Returns the name of this module.
virtual std::string describe ()
 Returns a string describing this module and its parameters.

Protected Member Functions

void update_scale (labeled_datasource< T, Tds1, Tds2 > &ds)
 Update the scale switch if an ms module was found in mod1.

Protected Attributes

ebm_2< Tin1, Tin2, Ten > & energy_mod
module_1_1< T, Tin1, Tin1 > & mod1
module_1_1< T, Tin1, Tin1 > * mod2
answer_module< T, Tds1, Tds2,
Tin1 > * 
dsmod1
answer_module< T, Tds1, Tds2,
Tin2 > * 
dsmod2
mstate< Tin1 > msin1
Tin1 in1
Tin1 out1
 Output of mod1.
Tin2 in2
Tin2 out2
Tin1 answers
Tin1 targets
string mod_name
Ten tmp_energy
ms_module< T, Tin1 > * ms_switch

Friends

class trainable_module_gui
class supervised_trainer
class supervised_trainer_gui

Detailed Description

template<typename T, typename Tds1 = T, typename Tds2 = T, class Tin1 = bbstate_idx<T>, class Tin2 = Tin1, class Ten = Tin1>
class ebl::trainable_module< T, Tds1, Tds2, Tin1, Tin2, Ten >

A module that takes a datasource 'ds' as input and produces an energy as output. Inputs will be gathered from the datasource and fed into a 2-input energy module. The way the inputs are gathered from the datasource can optionally be defined by specific information collection modules.


Constructor & Destructor Documentation

template<typename T, typename Tds1, typename Tds2, class Tin1, class Tin2, class Ten>
ebl::trainable_module< T, Tds1, Tds2, Tin1, Tin2, Ten >::trainable_module ( ebm_2< Tin1, Tin2, Ten > &  energy,
module_1_1< T, Tin1 > &  mod1,
module_1_1< T, Tin2 > *  mod2 = NULL,
answer_module< T, Tds1, Tds2, Tin1 > *  dsmod1 = NULL,
answer_module< T, Tds1, Tds2, Tin2 > *  dsmod2 = NULL,
const char *  name = "trainable_module< T, Tds1, Tds2, Tin1, Tin2, Ten >",
const char *  switcher = "" 
)

Constructor for ebm_2, i.e. 2 inputs producing an energy.

Parameters:
energyThe energy module.
mod1The 1st module.
mod2The 2nd module, optional because sometimes no processing is required on the 2nd flow of data.
dsmod1The module that picks/preprocesses data from ds to mod1, by default (null), will simply pass 'input' data from ds.
dsmod2The module that picks/preprocesses data from ds to mod2, by default (null), will simply pass 'label' data from ds.
switcherName of the module used to switch based on scale info.

Member Function Documentation

template<typename T , typename Tds1 , typename Tds2 , class Tin1 , class Tin2 , class Ten >
const Tin1 & ebl::trainable_module< T, Tds1, Tds2, Tin1, Tin2, Ten >::compute_answers ( ) [virtual]

Compute answers corresponding to the last input passed through fprop() and return a reference to the answer matrix. The answer matrix depends on the answer module defined as 'dsmod2'.

template<typename T , typename Tds1 , typename Tds2 , class Tin1, class Tin2 , class Ten >
void ebl::trainable_module< T, Tds1, Tds2, Tin1, Tin2, Ten >::compute_answers ( Tin1 &  ans) [virtual]

Compute answers corresponding to the last input passed through fprop() and put them into 'ans'. The answer matrix depends on the answer module defined as 'dsmod2'.

template<typename T, typename Tds1, typename Tds2, class Tin1 , class Tin2 , class Ten >
idx< T > ebl::trainable_module< T, Tds1, Tds2, Tin1, Tin2, Ten >::compute_targets ( labeled_datasource< T, Tds1, Tds2 > &  ds) [virtual]

Compute targets corresponding to the current sample of ds. and return a reference to the answer matrix. The targets matrix depends on the answer module defined as 'dsmod2'.


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