Public Member Functions | Protected Member Functions | Protected Attributes
clsfy_direct_boost Class Reference

Classifier using adaboost on combinations of simple 1D classifiers. More...

#include <clsfy_direct_boost.h>

Inheritance diagram for clsfy_direct_boost:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 clsfy_direct_boost ()
 Default constructor.
 clsfy_direct_boost (const clsfy_direct_boost &)
 Copy constructor.
clsfy_direct_boostoperator= (const clsfy_direct_boost &)
 Copy operator.
 ~clsfy_direct_boost ()
 Destructor.
bool operator== (const clsfy_direct_boost &x) const
 Comparison.
void clear ()
 Clear all wts and classifiers.
void add_one_classifier (clsfy_classifier_1d *c1d, double wt, int index)
 Add classifier and alpha value.
void set_n_clfrs_used (unsigned int x)
 Set number of classifiers used (when applying strong classifier).
int n_clfrs_used () const
 Access.
void add_one_threshold (double thresh)
 Add one threshold.
void add_final_threshold (double thresh)
 Add final threshold.
virtual void class_probabilities (vcl_vector< double > &outputs, const vnl_vector< double > &input) const
 Find the posterior probability of the input being in the positive class.
virtual unsigned classify (const vnl_vector< double > &input) const
 Classify the input vector.
virtual double log_l (const vnl_vector< double > &input) const
 Log likelihood of being in the positive class.
virtual unsigned n_dims () const
 The dimensionality of input vectors.
void set_n_dims (unsigned x)
 Set number of classifiers used (when applying strong classifier).
virtual unsigned n_classes () const
 The number of possible output classes.
void set_parameters (const vcl_vector< clsfy_classifier_1d * > &classifier, const vcl_vector< double > &threshes, const vcl_vector< double > &wts, const vcl_vector< int > &index)
 Set parameters. Clones taken of *classifier[i].
const vcl_vector
< clsfy_classifier_1d * > & 
classifiers () const
 Access functions.
const vcl_vector< double > & wts () const
const vcl_vector< int > & index () const
const vcl_vector< double > & threshes () const
short version_no () const
 Version number for I/O.
virtual vcl_string is_a () const
 Name of the class.
virtual bool is_class (vcl_string const &s) const
 Name of the class.
virtual void print_summary (vcl_ostream &os) const
 Print class to os.
virtual void b_write (vsl_b_ostream &bfs) const
 Save class to a binary File Stream.
virtual clsfy_classifier_baseclone () const
 Create a deep copy.
virtual void b_read (vsl_b_istream &bfs)
 Load the class from a Binary File Stream.
virtual void classify_many (vcl_vector< unsigned > &outputs, mbl_data_wrapper< vnl_vector< double > > &inputs) const
 Classify many input vectors.

Protected Member Functions

void delete_stuff ()
 Delete objects on heap.

Protected Attributes

vcl_vector< clsfy_classifier_1d * > classifier_1d_
 The classifiers in order.
vcl_vector< double > wts_
 Coefficients applied to each classifier.
vcl_vector< int > index_
 Index of input vector appropriate for each classifier.
vcl_vector< double > threshes_
 Thresholds given variable number of weak classifiers.
int n_clfrs_used_
 number of classifiers used.
int n_dims_
 dimensionality of data.

Detailed Description

Classifier using adaboost on combinations of simple 1D classifiers.

Uses a weighted combination of 1D classifiers applied to the elements of the input vector.

Definition at line 17 of file clsfy_direct_boost.h.


Constructor & Destructor Documentation

clsfy_direct_boost::clsfy_direct_boost ( )

Default constructor.

Definition at line 22 of file clsfy_direct_boost.cxx.

clsfy_direct_boost::clsfy_direct_boost ( const clsfy_direct_boost c)

Copy constructor.

Definition at line 27 of file clsfy_direct_boost.cxx.

clsfy_direct_boost::~clsfy_direct_boost ( )

Destructor.

Definition at line 64 of file clsfy_direct_boost.cxx.


Member Function Documentation

void clsfy_direct_boost::add_final_threshold ( double  thresh)

Add final threshold.

Definition at line 133 of file clsfy_direct_boost.cxx.

void clsfy_direct_boost::add_one_classifier ( clsfy_classifier_1d c1d,
double  wt,
int  index 
)

Add classifier and alpha value.

Add weak classifier and alpha value.

nb also changes n_clfrs_used to use all current weak classifiers nb calc total threshold (ie threshes_ separately, see below)

Definition at line 114 of file clsfy_direct_boost.cxx.

void clsfy_direct_boost::add_one_threshold ( double  thresh)

Add one threshold.

Definition at line 126 of file clsfy_direct_boost.cxx.

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

Load the class from a Binary File Stream.

Implements clsfy_classifier_base.

Definition at line 242 of file clsfy_direct_boost.cxx.

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

Save class to a binary File Stream.

Implements clsfy_classifier_base.

Definition at line 231 of file clsfy_direct_boost.cxx.

void clsfy_direct_boost::class_probabilities ( vcl_vector< double > &  outputs,
const vnl_vector< double > &  input 
) const [virtual]

Find the posterior probability of the input being in the positive class.

The result is outputs(0)

Implements clsfy_classifier_base.

Definition at line 165 of file clsfy_direct_boost.cxx.

const vcl_vector<clsfy_classifier_1d*>& clsfy_direct_boost::classifiers ( ) const [inline]

Access functions.

Definition at line 110 of file clsfy_direct_boost.h.

unsigned clsfy_direct_boost::classify ( const vnl_vector< double > &  v) const [virtual]

Classify the input vector.

Returns a number between 0 and nClasses-1 inclusive to represent the most likely class

Returns either 1 (for positive class) or 0 (for negative class)

Reimplemented from clsfy_classifier_base.

Definition at line 142 of file clsfy_direct_boost.cxx.

void clsfy_classifier_base::classify_many ( vcl_vector< unsigned > &  outputs,
mbl_data_wrapper< vnl_vector< double > > &  inputs 
) const [virtual, inherited]

Classify many input vectors.

Definition at line 55 of file clsfy_classifier_base.cxx.

void clsfy_direct_boost::clear ( )

Clear all wts and classifiers.

Definition at line 105 of file clsfy_direct_boost.cxx.

virtual clsfy_classifier_base* clsfy_direct_boost::clone ( ) const [inline, virtual]

Create a deep copy.

Client is responsible for deleting returned object.

Implements clsfy_classifier_base.

Definition at line 137 of file clsfy_direct_boost.h.

void clsfy_direct_boost::delete_stuff ( ) [protected]

Delete objects on heap.

Definition at line 50 of file clsfy_direct_boost.cxx.

const vcl_vector<int>& clsfy_direct_boost::index ( ) const [inline]

Definition at line 115 of file clsfy_direct_boost.h.

vcl_string clsfy_direct_boost::is_a ( ) const [virtual]

Name of the class.

Reimplemented from clsfy_classifier_base.

Definition at line 193 of file clsfy_direct_boost.cxx.

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

Name of the class.

Reimplemented from clsfy_classifier_base.

Definition at line 200 of file clsfy_direct_boost.cxx.

double clsfy_direct_boost::log_l ( const vnl_vector< double > &  v) const [virtual]

Log likelihood of being in the positive class.

Class probability = 1 / (1+exp(-log_l))

Implements clsfy_classifier_base.

Definition at line 176 of file clsfy_direct_boost.cxx.

virtual unsigned clsfy_direct_boost::n_classes ( ) const [inline, virtual]

The number of possible output classes.

1 indicates a binary classifier

Implements clsfy_classifier_base.

Definition at line 101 of file clsfy_direct_boost.h.

int clsfy_direct_boost::n_clfrs_used ( ) const [inline]

Access.

Definition at line 73 of file clsfy_direct_boost.h.

virtual unsigned clsfy_direct_boost::n_dims ( ) const [inline, virtual]

The dimensionality of input vectors.

Implements clsfy_classifier_base.

Definition at line 94 of file clsfy_direct_boost.h.

clsfy_direct_boost & clsfy_direct_boost::operator= ( const clsfy_direct_boost c)

Copy operator.

Definition at line 34 of file clsfy_direct_boost.cxx.

bool clsfy_direct_boost::operator== ( const clsfy_direct_boost x) const

Comparison.

Definition at line 71 of file clsfy_direct_boost.cxx.

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

Print class to os.

Implements clsfy_classifier_base.

Definition at line 208 of file clsfy_direct_boost.cxx.

void clsfy_direct_boost::set_n_clfrs_used ( unsigned int  x) [inline]

Set number of classifiers used (when applying strong classifier).

Definition at line 70 of file clsfy_direct_boost.h.

void clsfy_direct_boost::set_n_dims ( unsigned  x) [inline]

Set number of classifiers used (when applying strong classifier).

Definition at line 97 of file clsfy_direct_boost.h.

void clsfy_direct_boost::set_parameters ( const vcl_vector< clsfy_classifier_1d * > &  classifier,
const vcl_vector< double > &  threshes,
const vcl_vector< double > &  wts,
const vcl_vector< int > &  index 
)

Set parameters. Clones taken of *classifier[i].

Definition at line 85 of file clsfy_direct_boost.cxx.

const vcl_vector<double>& clsfy_direct_boost::threshes ( ) const [inline]

Definition at line 117 of file clsfy_direct_boost.h.

short clsfy_direct_boost::version_no ( ) const

Version number for I/O.

Definition at line 224 of file clsfy_direct_boost.cxx.

const vcl_vector<double>& clsfy_direct_boost::wts ( ) const [inline]

Definition at line 113 of file clsfy_direct_boost.h.


Member Data Documentation

The classifiers in order.

Definition at line 22 of file clsfy_direct_boost.h.

vcl_vector<int> clsfy_direct_boost::index_ [protected]

Index of input vector appropriate for each classifier.

Definition at line 28 of file clsfy_direct_boost.h.

number of classifiers used.

Definition at line 35 of file clsfy_direct_boost.h.

int clsfy_direct_boost::n_dims_ [protected]

dimensionality of data.

(ie size of input vectors v, ie the total number of different features)

Definition at line 39 of file clsfy_direct_boost.h.

vcl_vector<double> clsfy_direct_boost::threshes_ [protected]

Thresholds given variable number of weak classifiers.

ie threshes[nc-1] is the threshold when using nc weak classifiers

Definition at line 32 of file clsfy_direct_boost.h.

vcl_vector<double> clsfy_direct_boost::wts_ [protected]

Coefficients applied to each classifier.

Definition at line 25 of file clsfy_direct_boost.h.


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