A binary tree classifier. More...
#include <clsfy_binary_tree.h>
Classes | |
struct | graph_rep |
Public Member Functions | |
clsfy_binary_tree () | |
Constructor. | |
virtual | ~clsfy_binary_tree () |
clsfy_binary_tree (const clsfy_binary_tree &srcTree) | |
clsfy_binary_tree & | operator= (const clsfy_binary_tree &srcTree) |
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_base * | clone () 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. | |
void | set_root (clsfy_binary_tree_node *root) |
Normally only the builder uses this. | |
virtual void | classify_many (vcl_vector< unsigned > &outputs, mbl_data_wrapper< vnl_vector< double > > &inputs) const |
Classify many input vectors. | |
Static Public Member Functions | |
static void | remove_tree (clsfy_binary_tree_node *root) |
Private Member Functions | |
void | copy (const clsfy_binary_tree &srcTree) |
void | copy_children (clsfy_binary_tree_node *pSrcNode, clsfy_binary_tree_node *pNode) |
Private Attributes | |
clsfy_binary_tree_node * | root_ |
clsfy_binary_tree_node * | cache_node_ |
A binary tree classifier.
Drop down the tree using a binary threshold on a specific variable from the set at each node. Branch left for one classification, right for the other Eventually a node is reached with no children and that node's binary threshold classification is returned
Definition at line 99 of file clsfy_binary_tree.h.
clsfy_binary_tree::clsfy_binary_tree | ( | ) | [inline] |
Constructor.
Definition at line 111 of file clsfy_binary_tree.h.
clsfy_binary_tree::~clsfy_binary_tree | ( | ) | [virtual] |
Definition at line 375 of file clsfy_binary_tree.cxx.
clsfy_binary_tree::clsfy_binary_tree | ( | const clsfy_binary_tree & | srcTree | ) |
Definition at line 20 of file clsfy_binary_tree.cxx.
void clsfy_binary_tree::b_read | ( | vsl_b_istream & | bfs | ) | [virtual] |
Load class from binary file stream.
Implements clsfy_classifier_base.
Definition at line 254 of file clsfy_binary_tree.cxx.
void clsfy_binary_tree::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_binary_tree.cxx.
void clsfy_binary_tree::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 109 of file clsfy_binary_tree.cxx.
unsigned clsfy_binary_tree::classify | ( | const vnl_vector< double > & | input | ) | const [virtual] |
Return the classification of the given probe vector.
Reimplemented from clsfy_classifier_base.
Definition at line 70 of file clsfy_binary_tree.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.
clsfy_classifier_base * clsfy_binary_tree::clone | ( | ) | const [virtual] |
Create a copy on the heap and return base class pointer.
Implements clsfy_classifier_base.
Definition at line 169 of file clsfy_binary_tree.cxx.
void clsfy_binary_tree::copy | ( | const clsfy_binary_tree & | srcTree | ) | [private] |
Definition at line 35 of file clsfy_binary_tree.cxx.
void clsfy_binary_tree::copy_children | ( | clsfy_binary_tree_node * | pSrcNode, |
clsfy_binary_tree_node * | pNode | ||
) | [private] |
Definition at line 50 of file clsfy_binary_tree.cxx.
vcl_string clsfy_binary_tree::is_a | ( | ) | const [virtual] |
Name of the class.
Reimplemented from clsfy_classifier_base.
Definition at line 148 of file clsfy_binary_tree.cxx.
bool clsfy_binary_tree::is_class | ( | vcl_string const & | s | ) | const [virtual] |
Name of the class.
Reimplemented from clsfy_classifier_base.
Definition at line 155 of file clsfy_binary_tree.cxx.
double clsfy_binary_tree::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 132 of file clsfy_binary_tree.cxx.
virtual unsigned clsfy_binary_tree::n_classes | ( | ) | const [inline, virtual] |
The number of possible output classes.
Implements clsfy_classifier_base.
Definition at line 132 of file clsfy_binary_tree.h.
unsigned clsfy_binary_tree::n_dims | ( | ) | const [virtual] |
The dimensionality of input vectors.
Implements clsfy_classifier_base.
Definition at line 120 of file clsfy_binary_tree.cxx.
clsfy_binary_tree & clsfy_binary_tree::operator= | ( | const clsfy_binary_tree & | srcTree | ) |
Definition at line 26 of file clsfy_binary_tree.cxx.
void clsfy_binary_tree::print_summary | ( | vcl_ostream & | os | ) | const [virtual] |
Print class to os.
Implements clsfy_classifier_base.
Definition at line 176 of file clsfy_binary_tree.cxx.
void clsfy_binary_tree::remove_tree | ( | clsfy_binary_tree_node * | root | ) | [static] |
Definition at line 381 of file clsfy_binary_tree.cxx.
void clsfy_binary_tree::set_root | ( | clsfy_binary_tree_node * | root | ) |
Normally only the builder uses this.
Definition at line 408 of file clsfy_binary_tree.cxx.
short clsfy_binary_tree::version_no | ( | ) | const [virtual] |
Storage version number.
Definition at line 162 of file clsfy_binary_tree.cxx.
clsfy_binary_tree_node* clsfy_binary_tree::cache_node_ [mutable, private] |
Definition at line 162 of file clsfy_binary_tree.h.
clsfy_binary_tree_node* clsfy_binary_tree::root_ [private] |
Definition at line 161 of file clsfy_binary_tree.h.