Public Member Functions | Private Attributes | Friends
clsfy_random_forest Class Reference

Forest of clsfy_binary_tree trees. More...

#include <clsfy_random_forest.h>

Inheritance diagram for clsfy_random_forest:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 clsfy_random_forest ()
 Constructor.
virtual ~clsfy_random_forest ()
virtual unsigned classify (const vnl_vector< double > &input) const
 Return the classification of the given probe vector.
virtual void class_probabilities (vcl_vector< double > &outputs, const vnl_vector< double > &input) const
 Provides a probability-like value that the input being in each class.
virtual double log_l (const vnl_vector< double > &input) const
 This value has properties of a Log likelihood of being in class (binary classifiers only).
virtual unsigned n_classes () const
 The number of possible output classes.
virtual unsigned n_dims () const
 The dimensionality of input vectors.
virtual short version_no () const
 Storage version number.
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_classifier_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.
unsigned ntrees () const
void prune ()
clsfy_random_forestoperator+= (const clsfy_random_forest &forest2)
virtual void class_probabilities_oob (vcl_vector< double > &outputs, const vnl_vector< double > &input, const vcl_vector< vcl_vector< unsigned > > &oobIndices, unsigned this_index) const
 Provides a probability-like value that the input being in each class.
virtual unsigned classify_oob (const vnl_vector< double > &input, const vcl_vector< vcl_vector< unsigned > > &oobIndices, unsigned this_index) const
 Return the classification of the given probe vector using out of bag trees only.
virtual void classify_many (vcl_vector< unsigned > &outputs, mbl_data_wrapper< vnl_vector< double > > &inputs) const
 Classify many input vectors.

Private Attributes

vcl_vector< mbl_cloneable_ptr
< clsfy_classifier_base > > 
trees_
 The trees in this forest.

Friends

class clsfy_random_forest_builder
void merge_sub_forests (const vcl_vector< vcl_string > &filenames, clsfy_random_forest &large_forest)
 Merge the sub-forests in the input filenames into a single larger one.
void merge_sub_forests (const vcl_vector< clsfy_random_forest * > &sub_forests, clsfy_random_forest &large_forest)
 Merge the sub-forests pointed to the input vector a single larger one.
clsfy_random_forest operator+ (const clsfy_random_forest &forest1, const clsfy_random_forest &forest2)
 Merge the two input forests.

Detailed Description

Forest of clsfy_binary_tree trees.

Note as it uses clsfy_binary_tree this is a 2-state (binary) classifier also

Definition at line 16 of file clsfy_random_forest.h.


Constructor & Destructor Documentation

clsfy_random_forest::clsfy_random_forest ( )

Constructor.

Definition at line 20 of file clsfy_random_forest.cxx.

clsfy_random_forest::~clsfy_random_forest ( ) [virtual]

Definition at line 228 of file clsfy_random_forest.cxx.


Member Function Documentation

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

Load class from binary file stream.

Implements clsfy_classifier_base.

Definition at line 196 of file clsfy_random_forest.cxx.

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

Save class to binary file stream.

Implements clsfy_classifier_base.

Definition at line 182 of file clsfy_random_forest.cxx.

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

Provides a probability-like value that the input being in each class.

Return a probability like value that the input being in each class.

output(i) i<nClasses, contains the probability that the input is in class i

output(i) i<<nClasses, contains the probability that the input is in class i

Implements clsfy_classifier_base.

Definition at line 57 of file clsfy_random_forest.cxx.

void clsfy_random_forest::class_probabilities_oob ( vcl_vector< double > &  outputs,
const vnl_vector< double > &  input,
const vcl_vector< vcl_vector< unsigned > > &  oobIndices,
unsigned  this_index 
) const [virtual]

Provides a probability-like value that the input being in each class.

output(i) i<nClasses, contains the probability that the input is in class i Do Out of bag estimates, i.e. only use trees whose vector of indices does not include this_indexs

Definition at line 101 of file clsfy_random_forest.cxx.

unsigned clsfy_random_forest::classify ( const vnl_vector< double > &  input) const [virtual]

Return the classification of the given probe vector.

Reimplemented from clsfy_classifier_base.

Definition at line 26 of file clsfy_random_forest.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.

unsigned clsfy_random_forest::classify_oob ( const vnl_vector< double > &  input,
const vcl_vector< vcl_vector< unsigned > > &  oobIndices,
unsigned  this_index 
) const [virtual]

Return the classification of the given probe vector using out of bag trees only.

See also class_probabilities_oob

Definition at line 135 of file clsfy_random_forest.cxx.

clsfy_classifier_base * clsfy_random_forest::clone ( ) const [virtual]

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

Implements clsfy_classifier_base.

Definition at line 168 of file clsfy_random_forest.cxx.

vcl_string clsfy_random_forest::is_a ( ) const [virtual]

Name of the class.

Reimplemented from clsfy_classifier_base.

Definition at line 147 of file clsfy_random_forest.cxx.

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

Name of the class.

Reimplemented from clsfy_classifier_base.

Definition at line 154 of file clsfy_random_forest.cxx.

double clsfy_random_forest::log_l ( const vnl_vector< double > &  input) const [virtual]

This value has properties of a Log likelihood of being in class (binary classifiers only).

class probability = exp(logL) / (1+exp(logL))

Implements clsfy_classifier_base.

Definition at line 82 of file clsfy_random_forest.cxx.

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

The number of possible output classes.

Implements clsfy_classifier_base.

Definition at line 39 of file clsfy_random_forest.h.

unsigned clsfy_random_forest::n_dims ( ) const [virtual]

The dimensionality of input vectors.

Implements clsfy_classifier_base.

Definition at line 240 of file clsfy_random_forest.cxx.

unsigned clsfy_random_forest::ntrees ( ) const [inline]

Definition at line 65 of file clsfy_random_forest.h.

clsfy_random_forest & clsfy_random_forest::operator+= ( const clsfy_random_forest forest2)

Definition at line 248 of file clsfy_random_forest.cxx.

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

Print class to os.

Implements clsfy_classifier_base.

Definition at line 175 of file clsfy_random_forest.cxx.

void clsfy_random_forest::prune ( )

Definition at line 233 of file clsfy_random_forest.cxx.

short clsfy_random_forest::version_no ( ) const [virtual]

Storage version number.

Definition at line 161 of file clsfy_random_forest.cxx.


Friends And Related Function Documentation

friend class clsfy_random_forest_builder [friend]

Definition at line 104 of file clsfy_random_forest.h.

void merge_sub_forests ( const vcl_vector< vcl_string > &  filenames,
clsfy_random_forest large_forest 
) [friend]

Merge the sub-forests in the input filenames into a single larger one.

Definition at line 260 of file clsfy_random_forest.cxx.

void merge_sub_forests ( const vcl_vector< clsfy_random_forest * > &  sub_forests,
clsfy_random_forest large_forest 
) [friend]

Merge the sub-forests pointed to the input vector a single larger one.

Definition at line 279 of file clsfy_random_forest.cxx.

clsfy_random_forest operator+ ( const clsfy_random_forest forest1,
const clsfy_random_forest forest2 
) [friend]

Merge the two input forests.

Definition at line 295 of file clsfy_random_forest.cxx.


Member Data Documentation

The trees in this forest.

Definition at line 102 of file clsfy_random_forest.h.


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