A common interface for 1-out-of-N classifiers of 1D data. More...
#include <clsfy_classifier_1d.h>
Public Member Functions | |
clsfy_classifier_1d () | |
virtual | ~clsfy_classifier_1d () |
virtual unsigned | classify (double input) const |
Classify the input vector. | |
virtual vnl_vector< double > | params () const =0 |
Return parameters defining classifier in a vector (format depends on classifier). | |
virtual void | set_params (const vnl_vector< double > &p)=0 |
Set parameters defining classifier with a vector (format depends on classifier). | |
virtual void | class_probabilities (vcl_vector< double > &outputs, double input) const =0 |
Return the probability the input being in each class. | |
virtual void | classify_many (vcl_vector< unsigned > &outputs, mbl_data_wrapper< double > &inputs) const |
Classify many input vectors. | |
virtual double | log_l (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. If ==1, then it's a binary classifier. | |
virtual bool | operator== (const clsfy_classifier_1d &x) const =0 |
Equality operator for 1d classifiers. | |
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_1d * | 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 of 1D data.
This class takes a scalar 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 21 of file clsfy_classifier_1d.h.
clsfy_classifier_1d::clsfy_classifier_1d | ( | ) |
Definition at line 15 of file clsfy_classifier_1d.cxx.
clsfy_classifier_1d::~clsfy_classifier_1d | ( | ) | [virtual] |
Definition at line 21 of file clsfy_classifier_1d.cxx.
virtual void clsfy_classifier_1d::b_read | ( | vsl_b_istream & | bfs | ) | [pure virtual] |
Load class from binary file stream.
Implemented in clsfy_mean_square_1d, and clsfy_binary_threshold_1d.
virtual void clsfy_classifier_1d::b_write | ( | vsl_b_ostream & | bfs | ) | const [pure virtual] |
Save class to binary file stream.
Implemented in clsfy_mean_square_1d, and clsfy_binary_threshold_1d.
virtual void clsfy_classifier_1d::class_probabilities | ( | vcl_vector< double > & | outputs, |
double | input | ||
) | const [pure virtual] |
Return the probability the input being in each class.
output(i) 0<=i<n_classes, contains the probability that the input is in class i
Implemented in clsfy_binary_threshold_1d, and clsfy_mean_square_1d.
unsigned clsfy_classifier_1d::classify | ( | 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_threshold_1d, and clsfy_mean_square_1d.
Definition at line 27 of file clsfy_classifier_1d.cxx.
void clsfy_classifier_1d::classify_many | ( | vcl_vector< unsigned > & | outputs, |
mbl_data_wrapper< double > & | inputs | ||
) | const [virtual] |
Classify many input vectors.
Definition at line 61 of file clsfy_classifier_1d.cxx.
virtual clsfy_classifier_1d* clsfy_classifier_1d::clone | ( | ) | const [pure virtual] |
Create a copy on the heap and return base class pointer.
Implemented in clsfy_mean_square_1d, and clsfy_binary_threshold_1d.
vcl_string clsfy_classifier_1d::is_a | ( | ) | const [virtual] |
Name of the class.
Reimplemented in clsfy_mean_square_1d, and clsfy_binary_threshold_1d.
Definition at line 76 of file clsfy_classifier_1d.cxx.
bool clsfy_classifier_1d::is_class | ( | vcl_string const & | s | ) | const [virtual] |
Name of the class.
Reimplemented in clsfy_mean_square_1d, and clsfy_binary_threshold_1d.
Definition at line 81 of file clsfy_classifier_1d.cxx.
virtual double clsfy_classifier_1d::log_l | ( | 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_mean_square_1d, and clsfy_binary_threshold_1d.
virtual unsigned clsfy_classifier_1d::n_classes | ( | ) | const [pure virtual] |
The number of possible output classes. If ==1, then it's a binary classifier.
Implemented in clsfy_mean_square_1d, and clsfy_binary_threshold_1d.
virtual bool clsfy_classifier_1d::operator== | ( | const clsfy_classifier_1d & | x | ) | const [pure virtual] |
Equality operator for 1d classifiers.
Implemented in clsfy_mean_square_1d, and clsfy_binary_threshold_1d.
virtual vnl_vector<double> clsfy_classifier_1d::params | ( | ) | const [pure virtual] |
Return parameters defining classifier in a vector (format depends on classifier).
Implemented in clsfy_mean_square_1d, and clsfy_binary_threshold_1d.
virtual void clsfy_classifier_1d::print_summary | ( | vcl_ostream & | os | ) | const [pure virtual] |
Print class to os.
Implemented in clsfy_mean_square_1d, and clsfy_binary_threshold_1d.
virtual void clsfy_classifier_1d::set_params | ( | const vnl_vector< double > & | p | ) | [pure virtual] |
Set parameters defining classifier with a vector (format depends on classifier).
Implemented in clsfy_mean_square_1d, and clsfy_binary_threshold_1d.