Simplest possible 1D classifier: A single thresholding function. More...
#include <clsfy_mean_square_1d.h>
Public Member Functions | |
virtual void | class_probabilities (vcl_vector< double > &outputs, double input) const |
Find the posterior probability of the input being in the positive class. | |
virtual unsigned | classify (double input) const |
Classify the input vector. | |
virtual double | log_l (double input) const |
Log likelihood of being in the positive class/. | |
virtual unsigned | n_classes () const |
The number of possible output classes. | |
virtual vnl_vector< double > | params () const |
Return parameters defining classifier in a vector (format depends on classifier). | |
virtual void | set_params (const vnl_vector< double > &p) |
Set parameters defining classifier with a vector (format depends on classifier). | |
virtual bool | operator== (const clsfy_classifier_1d &x) const |
Equality operator for 1d classifiers. | |
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_1d * | clone () 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< double > &inputs) const |
Classify many input vectors. | |
Protected Attributes | |
double | mean_ |
double | threshold_ |
Simplest possible 1D classifier: A single thresholding function.
Returns class zero if s_*x<threshold_
Definition at line 16 of file clsfy_mean_square_1d.h.
void clsfy_mean_square_1d::b_read | ( | vsl_b_istream & | bfs | ) | [virtual] |
Load the class from a Binary File Stream.
Implements clsfy_classifier_1d.
Definition at line 106 of file clsfy_mean_square_1d.cxx.
void clsfy_mean_square_1d::b_write | ( | vsl_b_ostream & | bfs | ) | const [virtual] |
Save class to a binary File Stream.
Implements clsfy_classifier_1d.
Definition at line 97 of file clsfy_mean_square_1d.cxx.
void clsfy_mean_square_1d::class_probabilities | ( | vcl_vector< double > & | outputs, |
double | input | ||
) | const [virtual] |
Find the posterior probability of the input being in the positive class.
The result is outputs(0)
Implements clsfy_classifier_1d.
Definition at line 24 of file clsfy_mean_square_1d.cxx.
virtual unsigned clsfy_mean_square_1d::classify | ( | double | input | ) | const [inline, virtual] |
Classify the input vector.
Returns a number between 0 and nClasses-1 inclusive to represent the most likely class
Reimplemented from clsfy_classifier_1d.
Definition at line 29 of file clsfy_mean_square_1d.h.
void clsfy_classifier_1d::classify_many | ( | vcl_vector< unsigned > & | outputs, |
mbl_data_wrapper< double > & | inputs | ||
) | const [virtual, inherited] |
Classify many input vectors.
Definition at line 61 of file clsfy_classifier_1d.cxx.
virtual clsfy_classifier_1d* clsfy_mean_square_1d::clone | ( | ) | const [inline, virtual] |
Create a deep copy.
Client is responsible for deleting returned object.
Implements clsfy_classifier_1d.
Definition at line 74 of file clsfy_mean_square_1d.h.
vcl_string clsfy_mean_square_1d::is_a | ( | ) | const [virtual] |
Name of the class.
Reimplemented from clsfy_classifier_1d.
Definition at line 70 of file clsfy_mean_square_1d.cxx.
bool clsfy_mean_square_1d::is_class | ( | vcl_string const & | s | ) | const [virtual] |
Name of the class.
Reimplemented from clsfy_classifier_1d.
Definition at line 75 of file clsfy_mean_square_1d.cxx.
double clsfy_mean_square_1d::log_l | ( | double | input | ) | const [virtual] |
Log likelihood of being in the positive class/.
Log likelihood of being in the positive class.
Class probability = 1 / (1+exp(-log_l))
Implements clsfy_classifier_1d.
Definition at line 36 of file clsfy_mean_square_1d.cxx.
virtual unsigned clsfy_mean_square_1d::n_classes | ( | ) | const [inline, virtual] |
The number of possible output classes.
1 indicates a binary classifier
Implements clsfy_classifier_1d.
Definition at line 46 of file clsfy_mean_square_1d.h.
bool clsfy_mean_square_1d::operator== | ( | const clsfy_classifier_1d & | x | ) | const [virtual] |
Equality operator for 1d classifiers.
Implements clsfy_classifier_1d.
Definition at line 61 of file clsfy_mean_square_1d.cxx.
vnl_vector< double > clsfy_mean_square_1d::params | ( | ) | const [virtual] |
Return parameters defining classifier in a vector (format depends on classifier).
Implements clsfy_classifier_1d.
Definition at line 45 of file clsfy_mean_square_1d.cxx.
void clsfy_mean_square_1d::print_summary | ( | vcl_ostream & | os | ) | const [virtual] |
Print class to os.
Implements clsfy_classifier_1d.
Definition at line 83 of file clsfy_mean_square_1d.cxx.
void clsfy_mean_square_1d::set_params | ( | const vnl_vector< double > & | p | ) | [virtual] |
Set parameters defining classifier with a vector (format depends on classifier).
Implements clsfy_classifier_1d.
Definition at line 51 of file clsfy_mean_square_1d.cxx.
short clsfy_mean_square_1d::version_no | ( | ) | const |
Version number for I/O.
Definition at line 90 of file clsfy_mean_square_1d.cxx.
double clsfy_mean_square_1d::mean_ [protected] |
Definition at line 19 of file clsfy_mean_square_1d.h.
double clsfy_mean_square_1d::threshold_ [protected] |
Definition at line 20 of file clsfy_mean_square_1d.h.