Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
clsfy_direct_boost_builder Class Reference

Base for classes to build clsfy_classifier_base objects. More...

#include <clsfy_direct_boost_builder.h>

Inheritance diagram for clsfy_direct_boost_builder:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 clsfy_direct_boost_builder ()
virtual ~clsfy_direct_boost_builder ()
virtual clsfy_classifier_basenew_classifier () const
 Create empty model.
void set_batch_size (int bs)
 set batch size.
void set_save_data_to_disk (bool x)
 set save data to disk bool.
void set_max_n_clfrs (int max_n_clfrs)
 set max_n_clfrs.
void set_weak_builder (clsfy_builder_1d &weak_builder)
 set weak builder ( a pointer is retained ).
void set_calc_all_thresholds (bool x)
 set stuff.
void set_prop (double prop)
virtual double build (clsfy_classifier_base &model, mbl_data_wrapper< vnl_vector< double > > &inputs, unsigned nClasses, const vcl_vector< unsigned > &outputs) const
 Build model from data.
virtual vcl_string is_a () const
 Name of the class.
virtual bool is_class (vcl_string const &s) const
 Name of the class.
virtual clsfy_builder_baseclone () const
 Create a copy on the heap and return base class pointer.
virtual void print_summary (vcl_ostream &os) const
 Print class to os.
virtual void b_write (vsl_b_ostream &bfs) const
 Save class to binary file stream.
virtual void b_read (vsl_b_istream &bfs)
 Load class from binary file stream.
virtual void config (vcl_istream &as)
 Initialise the parameters from a text stream.

Static Public Member Functions

static vcl_auto_ptr
< clsfy_builder_base
new_builder (vcl_istream &as)
 Load description from a text stream.

Private Member Functions

double calc_threshold (clsfy_direct_boost &strong_classifier, mbl_data_wrapper< vnl_vector< double > > &inputs, const vcl_vector< unsigned > &outputs) const
 Calc threshold for current version of strong classifier.
double calc_prop_same (const vcl_vector< bool > &vec1, const vcl_vector< bool > &vec2) const
 Calc similarity between two 1d input vectors.

Private Attributes

bool calc_all_thresholds_
 calc all threshold not just last one.
double prop_
 proportion of sum of square distance from mean used to say whether two classifiers are too similar.
bool save_data_to_disk_
 bool indicating whether or not to save data to disk.
int bs_
 batch size.
int max_n_clfrs_
 maximum number of classifiers found by Adaboost algorithm.
clsfy_builder_1dweak_builder_
 pointer to 1d builder used to build each weak classifier.

Detailed Description

Base for classes to build clsfy_classifier_base objects.

Definition at line 22 of file clsfy_direct_boost_builder.h.


Constructor & Destructor Documentation

clsfy_direct_boost_builder::clsfy_direct_boost_builder ( )

Definition at line 32 of file clsfy_direct_boost_builder.cxx.

clsfy_direct_boost_builder::~clsfy_direct_boost_builder ( ) [virtual]

Definition at line 39 of file clsfy_direct_boost_builder.cxx.


Member Function Documentation

void clsfy_direct_boost_builder::b_read ( vsl_b_istream bfs) [virtual]

Load class from binary file stream.

Implements clsfy_builder_base.

Definition at line 498 of file clsfy_direct_boost_builder.cxx.

void clsfy_direct_boost_builder::b_write ( vsl_b_ostream bfs) const [virtual]

Save class to binary file stream.

Implements clsfy_builder_base.

Definition at line 485 of file clsfy_direct_boost_builder.cxx.

double clsfy_direct_boost_builder::build ( clsfy_classifier_base model,
mbl_data_wrapper< vnl_vector< double > > &  inputs,
unsigned  nClasses,
const vcl_vector< unsigned > &  outputs 
) const [virtual]

Build model from data.

Build classifier composed of 1d classifiers working on individual vector elements.

Return the mean error over the training set. For many classifiers, you may use nClasses==1 to indicate a binary classifier

Builds an n-component classifier, each component of which is a 1D classifier working on a single element of the input vector.

Implements clsfy_builder_base.

Definition at line 148 of file clsfy_direct_boost_builder.cxx.

double clsfy_direct_boost_builder::calc_prop_same ( const vcl_vector< bool > &  vec1,
const vcl_vector< bool > &  vec2 
) const [private]

Calc similarity between two 1d input vectors.

Definition at line 60 of file clsfy_direct_boost_builder.cxx.

double clsfy_direct_boost_builder::calc_threshold ( clsfy_direct_boost strong_classifier,
mbl_data_wrapper< vnl_vector< double > > &  inputs,
const vcl_vector< unsigned > &  outputs 
) const [private]

Calc threshold for current version of strong classifier.

Definition at line 76 of file clsfy_direct_boost_builder.cxx.

clsfy_builder_base * clsfy_direct_boost_builder::clone ( ) const [virtual]

Create a copy on the heap and return base class pointer.

Implements clsfy_builder_base.

Definition at line 464 of file clsfy_direct_boost_builder.cxx.

void clsfy_builder_base::config ( vcl_istream &  as) [virtual, inherited]

Initialise the parameters from a text stream.

Default case accepts no parameters.

Reimplemented in clsfy_rbf_svm_smo_1_builder, clsfy_parzen_builder, clsfy_knn_builder, clsfy_null_builder, and clsfy_binary_1d_wrapper_builder.

Definition at line 26 of file clsfy_builder_base.cxx.

vcl_string clsfy_direct_boost_builder::is_a ( ) const [virtual]

Name of the class.

Reimplemented from clsfy_builder_base.

Definition at line 53 of file clsfy_direct_boost_builder.cxx.

bool clsfy_direct_boost_builder::is_class ( vcl_string const &  s) const [virtual]

Name of the class.

Reimplemented from clsfy_builder_base.

Definition at line 46 of file clsfy_direct_boost_builder.cxx.

vcl_auto_ptr< clsfy_builder_base > clsfy_builder_base::new_builder ( vcl_istream &  as) [static, inherited]

Load description from a text stream.

The stream should contain the name of the feature extractor class that will be used, followed by a brace-enclosed list of parameters for the builder. This function will construct the appropriate clsfy_builder_base derivative and return that.

Exceptions:
ifthe parse fails.

Definition at line 42 of file clsfy_builder_base.cxx.

clsfy_classifier_base * clsfy_direct_boost_builder::new_classifier ( ) const [virtual]

Create empty model.

Create empty classifier.

Caller is responsible for deletion

Implements clsfy_builder_base.

Definition at line 423 of file clsfy_direct_boost_builder.cxx.

void clsfy_direct_boost_builder::print_summary ( vcl_ostream &  os) const [virtual]

Print class to os.

Implements clsfy_builder_base.

Definition at line 472 of file clsfy_direct_boost_builder.cxx.

void clsfy_direct_boost_builder::set_batch_size ( int  bs) [inline]

set batch size.

Definition at line 72 of file clsfy_direct_boost_builder.h.

void clsfy_direct_boost_builder::set_calc_all_thresholds ( bool  x) [inline]

set stuff.

Definition at line 85 of file clsfy_direct_boost_builder.h.

void clsfy_direct_boost_builder::set_max_n_clfrs ( int  max_n_clfrs) [inline]

set max_n_clfrs.

Definition at line 78 of file clsfy_direct_boost_builder.h.

void clsfy_direct_boost_builder::set_prop ( double  prop) [inline]

Definition at line 86 of file clsfy_direct_boost_builder.h.

void clsfy_direct_boost_builder::set_save_data_to_disk ( bool  x) [inline]

set save data to disk bool.

Definition at line 75 of file clsfy_direct_boost_builder.h.

void clsfy_direct_boost_builder::set_weak_builder ( clsfy_builder_1d weak_builder) [inline]

set weak builder ( a pointer is retained ).

Definition at line 81 of file clsfy_direct_boost_builder.h.


Member Data Documentation

batch size.

ie number of training examples held in RAM whilst sorting takes place

Definition at line 41 of file clsfy_direct_boost_builder.h.

calc all threshold not just last one.

Definition at line 27 of file clsfy_direct_boost_builder.h.

maximum number of classifiers found by Adaboost algorithm.

Definition at line 44 of file clsfy_direct_boost_builder.h.

proportion of sum of square distance from mean used to say whether two classifiers are too similar.

typically = 0.1 ish.

Definition at line 31 of file clsfy_direct_boost_builder.h.

bool indicating whether or not to save data to disk.

NB useful to save data to disk, if don't have enough RAM but also makes training very slow

Definition at line 37 of file clsfy_direct_boost_builder.h.

pointer to 1d builder used to build each weak classifier.

Definition at line 47 of file clsfy_direct_boost_builder.h.


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