Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

PLearn::AdaBoost Class Reference

#include <AdaBoost.h>

Inheritance diagram for PLearn::AdaBoost:

Inheritance graph
[legend]
Collaboration diagram for PLearn::AdaBoost:

Collaboration graph
[legend]
List of all members.

Public Types

typedef PLearner inherited

Public Member Functions

 AdaBoost ()
virtual void build ()
 simply calls inherited::build() then build_()

virtual void makeDeepCopyFromShallowCopy (map< const void *, void * > &copies)
 Transforms a shallow copy into a deep copy.

 PLEARN_DECLARE_OBJECT (AdaBoost)
virtual int outputsize () const
 returns the size of this learner's output, (which typically may depend on its inputsize(), targetsize() and set options) This implementation of AdaBoost always performs two-class classification, hence returns 1

virtual void forget ()
 (Re-)initializes the PLearner in its fresh state (that state may depend on the 'seed' option) And sets 'stage' back to 0 (this is the stage of a fresh learner!)

virtual void train ()
 The role of the train method is to bring the learner up to stage==nstages, updating the train_stats collector with training costs measured on-line in the process.

virtual void computeOutput (const Vec &input, Vec &output) const
 Computes the output from the input.

virtual void computeCostsFromOutputs (const Vec &input, const Vec &output, const Vec &target, Vec &costs) const
 Computes the costs from already computed output.

virtual TVec< stringgetTestCostNames () const
 Returns the names of the costs computed by computeCostsFromOutpus (and thus the test method).

virtual TVec< stringgetTrainCostNames () const
 Returns the names of the objective costs that the train method computes and for which it updates the VecStatsCollector train_stats.


Public Attributes

PP< PLearnerweak_learner_template
 Weak learner to use as a template for each boosting round.

real target_error
bool provide_learner_expdir
real output_threshold
bool compute_training_error
bool pseudo_loss_adaboost
bool weight_by_resampling
bool early_stopping
bool save_often

Static Protected Member Functions

void declareOptions (OptionList &ol)
 Declares this class' options.


Protected Attributes

Vec learners_error
Vec example_weights
Vec voting_weights
real sum_voting_weights
real initial_sum_weights
TVec< PP< PLearner > > weak_learners
 Vector of weak learners learned from boosting.


Private Member Functions

void build_ ()
 This does the actual building.


Member Typedef Documentation

typedef PLearner PLearn::AdaBoost::inherited
 

Reimplemented from PLearn::PLearner.

Definition at line 54 of file AdaBoost.h.


Constructor & Destructor Documentation

PLearn::AdaBoost::AdaBoost  ) 
 

Definition at line 52 of file AdaBoost.cc.


Member Function Documentation

void PLearn::AdaBoost::build  )  [virtual]
 

simply calls inherited::build() then build_()

Reimplemented from PLearn::PLearner.

Definition at line 132 of file AdaBoost.cc.

References build_().

void PLearn::AdaBoost::build_  )  [private]
 

This does the actual building.

Reimplemented from PLearn::PLearner.

Definition at line 127 of file AdaBoost.cc.

Referenced by build().

void PLearn::AdaBoost::computeCostsFromOutputs const Vec input,
const Vec output,
const Vec target,
Vec costs
const [virtual]
 

Computes the costs from already computed output.

Implements PLearn::PLearner.

Definition at line 383 of file AdaBoost.cc.

References output_threshold, PLERROR, PLearn::TVec< T >::resize(), and PLearn::TVec< T >::size().

void PLearn::AdaBoost::computeOutput const Vec input,
Vec output
const [virtual]
 

Computes the output from the input.

Implements PLearn::PLearner.

Definition at line 370 of file AdaBoost.cc.

References PLearn::TVec< T >::length(), PLearn::TVec< T >::resize(), sum_voting_weights, voting_weights, and weak_learners.

void PLearn::AdaBoost::declareOptions OptionList ol  )  [static, protected]
 

Declares this class' options.

Reimplemented from PLearn::PLearner.

Definition at line 71 of file AdaBoost.cc.

References PLearn::declareOption(), and PLearn::OptionList.

void PLearn::AdaBoost::forget  )  [virtual]
 

(Re-)initializes the PLearner in its fresh state (that state may depend on the 'seed' option) And sets 'stage' back to 0 (this is the stage of a fresh learner!)

Implements PLearn::PLearner.

Definition at line 157 of file AdaBoost.cc.

References learners_error, PLearn::manual_seed(), PLearn::TVec< PP< PLearner > >::resize(), PLearn::TVec< T >::resize(), PLearn::seed(), sum_voting_weights, voting_weights, and weak_learners.

Referenced by train().

TVec< string > PLearn::AdaBoost::getTestCostNames  )  const [virtual]
 

Returns the names of the costs computed by computeCostsFromOutpus (and thus the test method).

Implements PLearn::PLearner.

Definition at line 403 of file AdaBoost.cc.

References getTrainCostNames().

TVec< string > PLearn::AdaBoost::getTrainCostNames  )  const [virtual]
 

Returns the names of the objective costs that the train method computes and for which it updates the VecStatsCollector train_stats.

Implements PLearn::PLearner.

Definition at line 408 of file AdaBoost.cc.

Referenced by getTestCostNames().

void PLearn::AdaBoost::makeDeepCopyFromShallowCopy map< const void *, void * > &  copies  )  [virtual]
 

Transforms a shallow copy into a deep copy.

Definition at line 139 of file AdaBoost.cc.

References PLearn::deepCopyField(), example_weights, learners_error, voting_weights, weak_learner_template, and weak_learners.

int PLearn::AdaBoost::outputsize  )  const [virtual]
 

returns the size of this learner's output, (which typically may depend on its inputsize(), targetsize() and set options) This implementation of AdaBoost always performs two-class classification, hence returns 1

Implements PLearn::PLearner.

Definition at line 151 of file AdaBoost.cc.

PLearn::AdaBoost::PLEARN_DECLARE_OBJECT AdaBoost   ) 
 

void PLearn::AdaBoost::train  )  [virtual]
 

The role of the train method is to bring the learner up to stage==nstages, updating the train_stats collector with training costs measured on-line in the process.

< Asking to revert to previous stage

Implements PLearn::PLearner.

Definition at line 170 of file AdaBoost.cc.

References PLearn::append_slash(), compute_training_error, early_stopping, PLearn::endl(), example_weights, PLearn::exp(), PLearn::TVec< T >::fill(), forget(), PLearn::gaussian_mu_sigma(), PLearn::VMat::getExample(), initial_sum_weights, PLearn::PLearner::inputsize(), k, learners_error, PLearn::VMat::length(), PLearn::Mat, output_threshold, PLERROR, provide_learner_expdir, pseudo_loss_adaboost, PLearn::TVec< PP< PLearner > >::push_back(), PLearn::TVec< T >::push_back(), PLearn::TVec< T >::resize(), PLearn::safeflog(), PLearn::save(), save_often, PLearn::sqrt(), PLearn::VMat::subMatColumns(), sum_voting_weights, target_error, PLearn::PLearner::targetsize(), PLearn::TVec< T >::toMat(), PLearn::tostring(), PLearn::uniform_sample(), PLearn::ProgressBar::update(), voting_weights, weak_learner_template, weak_learners, and weight_by_resampling.


Member Data Documentation

bool PLearn::AdaBoost::compute_training_error
 

Definition at line 99 of file AdaBoost.h.

Referenced by train().

bool PLearn::AdaBoost::early_stopping
 

Definition at line 108 of file AdaBoost.h.

Referenced by train().

Vec PLearn::AdaBoost::example_weights [protected]
 

Definition at line 62 of file AdaBoost.h.

Referenced by makeDeepCopyFromShallowCopy(), and train().

real PLearn::AdaBoost::initial_sum_weights [protected]
 

Definition at line 72 of file AdaBoost.h.

Referenced by train().

Vec PLearn::AdaBoost::learners_error [protected]
 

Definition at line 60 of file AdaBoost.h.

Referenced by forget(), makeDeepCopyFromShallowCopy(), and train().

real PLearn::AdaBoost::output_threshold
 

Definition at line 96 of file AdaBoost.h.

Referenced by computeCostsFromOutputs(), and train().

bool PLearn::AdaBoost::provide_learner_expdir
 

Definition at line 93 of file AdaBoost.h.

Referenced by train().

bool PLearn::AdaBoost::pseudo_loss_adaboost
 

Definition at line 102 of file AdaBoost.h.

Referenced by train().

bool PLearn::AdaBoost::save_often
 

Definition at line 111 of file AdaBoost.h.

Referenced by train().

real PLearn::AdaBoost::sum_voting_weights [protected]
 

Definition at line 71 of file AdaBoost.h.

Referenced by computeOutput(), forget(), and train().

real PLearn::AdaBoost::target_error
 

Definition at line 90 of file AdaBoost.h.

Referenced by train().

Vec PLearn::AdaBoost::voting_weights [protected]
 

Definition at line 70 of file AdaBoost.h.

Referenced by computeOutput(), forget(), makeDeepCopyFromShallowCopy(), and train().

PP<PLearner> PLearn::AdaBoost::weak_learner_template
 

Weak learner to use as a template for each boosting round.

AdaBoost requires classification weak-learners that provide an essential non-linearity (e.g. linear regression does not work) NOTE: this weak learner must support deepCopy().

Definition at line 87 of file AdaBoost.h.

Referenced by makeDeepCopyFromShallowCopy(), and train().

TVec< PP<PLearner> > PLearn::AdaBoost::weak_learners [protected]
 

Vector of weak learners learned from boosting.

Definition at line 75 of file AdaBoost.h.

Referenced by computeOutput(), forget(), makeDeepCopyFromShallowCopy(), and train().

bool PLearn::AdaBoost::weight_by_resampling
 

Definition at line 105 of file AdaBoost.h.

Referenced by train().


The documentation for this class was generated from the following files:
Generated on Tue Aug 17 16:27:06 2004 for PLearn by doxygen 1.3.7