A common interface for 1-out-of-N classifiers. More...
#include <clsfy_classifier_base.h>
Public Member Functions | |
clsfy_classifier_base () | |
virtual | ~clsfy_classifier_base () |
virtual unsigned | classify (const vnl_vector< double > &input) const |
Classify the input vector. | |
virtual void | class_probabilities (vcl_vector< double > &outputs, const vnl_vector< double > &input) const =0 |
Return the probability the input being in each class. | |
virtual void | classify_many (vcl_vector< unsigned > &outputs, mbl_data_wrapper< vnl_vector< double > > &inputs) const |
Classify many input vectors. | |
virtual double | log_l (const vnl_vector< double > &input) const =0 |
Log likelihood of being in class (binary classifiers only). | |
virtual unsigned | n_classes () const =0 |
The number of possible output classes. | |
virtual unsigned | n_dims () const =0 |
The dimensionality of input vectors. | |
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 =0 |
Create a copy on the heap and return base class pointer. | |
virtual void | print_summary (vcl_ostream &os) const =0 |
Print class to os. | |
virtual void | b_write (vsl_b_ostream &bfs) const =0 |
Save class to binary file stream. | |
virtual void | b_read (vsl_b_istream &bfs)=0 |
Load class from binary file stream. |
A common interface for 1-out-of-N classifiers.
This class takes a vector and classifies into one of N classes.
Derived classes with binary in the name indicates that the classifier works with only two classes, 0 and 1.
Definition at line 29 of file clsfy_classifier_base.h.
clsfy_classifier_base::clsfy_classifier_base | ( | ) | [inline] |
Definition at line 34 of file clsfy_classifier_base.h.
virtual clsfy_classifier_base::~clsfy_classifier_base | ( | ) | [inline, virtual] |
Definition at line 37 of file clsfy_classifier_base.h.
virtual void clsfy_classifier_base::b_read | ( | vsl_b_istream & | bfs | ) | [pure virtual] |
Load class from binary file stream.
Implemented in clsfy_binary_tree, clsfy_direct_boost, clsfy_simple_adaboost, clsfy_rbf_svm, clsfy_rbf_parzen, clsfy_binary_pdf_classifier, clsfy_k_nearest_neighbour, clsfy_binary_hyperplane, clsfy_null_classifier, clsfy_random_classifier, clsfy_binary_1d_wrapper, and clsfy_random_forest.
virtual void clsfy_classifier_base::b_write | ( | vsl_b_ostream & | bfs | ) | const [pure virtual] |
Save class to binary file stream.
Implemented in clsfy_binary_tree, clsfy_direct_boost, clsfy_rbf_svm, clsfy_simple_adaboost, clsfy_rbf_parzen, clsfy_binary_pdf_classifier, clsfy_k_nearest_neighbour, clsfy_binary_hyperplane, clsfy_null_classifier, clsfy_random_classifier, clsfy_binary_1d_wrapper, and clsfy_random_forest.
virtual void clsfy_classifier_base::class_probabilities | ( | vcl_vector< double > & | outputs, |
const vnl_vector< double > & | input | ||
) | const [pure virtual] |
Return the probability the input being in each class.
output(i) 0<=i<nClasses, contains the probability that the input is in class i
Implemented in clsfy_binary_tree, clsfy_direct_boost, clsfy_simple_adaboost, clsfy_rbf_svm, clsfy_rbf_parzen, clsfy_binary_pdf_classifier, clsfy_random_classifier, clsfy_k_nearest_neighbour, clsfy_random_forest, clsfy_binary_hyperplane, clsfy_null_classifier, and clsfy_binary_1d_wrapper.
unsigned clsfy_classifier_base::classify | ( | const vnl_vector< double > & | input | ) | const [virtual] |
Classify the input vector.
returns a number between 0 and nClasses-1 inclusive to represent the most likely class
Reimplemented in clsfy_binary_tree, clsfy_direct_boost, clsfy_simple_adaboost, clsfy_rbf_svm, clsfy_rbf_parzen, clsfy_binary_pdf_classifier, clsfy_k_nearest_neighbour, clsfy_binary_1d_wrapper, clsfy_binary_hyperplane, and clsfy_random_forest.
Definition at line 21 of file clsfy_classifier_base.cxx.
void clsfy_classifier_base::classify_many | ( | vcl_vector< unsigned > & | outputs, |
mbl_data_wrapper< vnl_vector< double > > & | inputs | ||
) | const [virtual] |
Classify many input vectors.
Definition at line 55 of file clsfy_classifier_base.cxx.
virtual clsfy_classifier_base* clsfy_classifier_base::clone | ( | ) | const [pure virtual] |
Create a copy on the heap and return base class pointer.
Implemented in clsfy_binary_tree, clsfy_direct_boost, clsfy_simple_adaboost, clsfy_rbf_svm, clsfy_rbf_parzen, clsfy_binary_pdf_classifier, clsfy_k_nearest_neighbour, clsfy_binary_hyperplane, clsfy_binary_1d_wrapper, clsfy_null_classifier, clsfy_random_classifier, and clsfy_random_forest.
vcl_string clsfy_classifier_base::is_a | ( | ) | const [virtual] |
Name of the class.
Reimplemented in clsfy_binary_tree, clsfy_direct_boost, clsfy_rbf_svm, clsfy_simple_adaboost, clsfy_rbf_parzen, clsfy_binary_pdf_classifier, clsfy_k_nearest_neighbour, clsfy_binary_hyperplane, clsfy_binary_1d_wrapper, clsfy_null_classifier, clsfy_random_classifier, and clsfy_random_forest.
Definition at line 70 of file clsfy_classifier_base.cxx.
bool clsfy_classifier_base::is_class | ( | vcl_string const & | s | ) | const [virtual] |
Name of the class.
Reimplemented in clsfy_binary_tree, clsfy_direct_boost, clsfy_rbf_svm, clsfy_simple_adaboost, clsfy_rbf_parzen, clsfy_binary_pdf_classifier, clsfy_k_nearest_neighbour, clsfy_binary_hyperplane, clsfy_binary_1d_wrapper, clsfy_null_classifier, clsfy_random_classifier, and clsfy_random_forest.
Definition at line 77 of file clsfy_classifier_base.cxx.
virtual double clsfy_classifier_base::log_l | ( | const vnl_vector< double > & | input | ) | const [pure virtual] |
Log likelihood of being in class (binary classifiers only).
class probability = 1 / (1+exp(-log_l)) Operation of this method is undefined for multiclass classifiers
Implemented in clsfy_binary_tree, clsfy_direct_boost, clsfy_simple_adaboost, clsfy_rbf_svm, clsfy_rbf_parzen, clsfy_binary_pdf_classifier, clsfy_random_classifier, clsfy_k_nearest_neighbour, clsfy_binary_1d_wrapper, clsfy_binary_hyperplane, clsfy_random_forest, and clsfy_null_classifier.
virtual unsigned clsfy_classifier_base::n_classes | ( | ) | const [pure virtual] |
The number of possible output classes.
Implemented in clsfy_binary_tree, clsfy_rbf_svm, clsfy_direct_boost, clsfy_rbf_parzen, clsfy_binary_pdf_classifier, clsfy_simple_adaboost, clsfy_k_nearest_neighbour, clsfy_binary_hyperplane, clsfy_binary_1d_wrapper, clsfy_random_classifier, clsfy_random_forest, and clsfy_null_classifier.
virtual unsigned clsfy_classifier_base::n_dims | ( | ) | const [pure virtual] |
The dimensionality of input vectors.
Implemented in clsfy_binary_tree, clsfy_rbf_svm, clsfy_rbf_parzen, clsfy_direct_boost, clsfy_binary_pdf_classifier, clsfy_simple_adaboost, clsfy_k_nearest_neighbour, clsfy_random_classifier, clsfy_binary_hyperplane, clsfy_binary_1d_wrapper, clsfy_random_forest, and clsfy_null_classifier.
virtual void clsfy_classifier_base::print_summary | ( | vcl_ostream & | os | ) | const [pure virtual] |
Print class to os.
Implemented in clsfy_binary_tree, clsfy_direct_boost, clsfy_rbf_svm, clsfy_simple_adaboost, clsfy_rbf_parzen, clsfy_binary_pdf_classifier, clsfy_k_nearest_neighbour, clsfy_binary_hyperplane, clsfy_null_classifier, clsfy_random_classifier, clsfy_binary_1d_wrapper, and clsfy_random_forest.