Simplest possible 1D classifier: A single thresholding function. More...
#include <clsfy_binary_threshold_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/. | |
void | set (double s, double t) |
Set the threshold and orientation. | |
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 | s_ |
double | threshold_ |
Simplest possible 1D classifier: A single thresholding function.
Returns class zero if s_*x<threshold_
Definition at line 16 of file clsfy_binary_threshold_1d.h.
void clsfy_binary_threshold_1d::b_read | ( | vsl_b_istream & | bfs | ) | [virtual] |
Load the class from a Binary File Stream.
Implements clsfy_classifier_1d.
Definition at line 104 of file clsfy_binary_threshold_1d.cxx.
void clsfy_binary_threshold_1d::b_write | ( | vsl_b_ostream & | bfs | ) | const [virtual] |
Save class to a binary File Stream.
Implements clsfy_classifier_1d.
Definition at line 95 of file clsfy_binary_threshold_1d.cxx.
void clsfy_binary_threshold_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_binary_threshold_1d.cxx.
virtual unsigned clsfy_binary_threshold_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_binary_threshold_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_binary_threshold_1d::clone | ( | ) | const [inline, virtual] |
Create a deep copy.
Client is responsible for deleting returned object.
Implements clsfy_classifier_1d.
Definition at line 70 of file clsfy_binary_threshold_1d.h.
vcl_string clsfy_binary_threshold_1d::is_a | ( | ) | const [virtual] |
Name of the class.
Reimplemented from clsfy_classifier_1d.
Definition at line 67 of file clsfy_binary_threshold_1d.cxx.
bool clsfy_binary_threshold_1d::is_class | ( | vcl_string const & | s | ) | const [virtual] |
Name of the class.
Reimplemented from clsfy_classifier_1d.
Definition at line 72 of file clsfy_binary_threshold_1d.cxx.
double clsfy_binary_threshold_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_binary_threshold_1d.cxx.
virtual unsigned clsfy_binary_threshold_1d::n_classes | ( | ) | const [inline, virtual] |
The number of possible output classes.
1 indicates a binary classifier
Implements clsfy_classifier_1d.
Definition at line 42 of file clsfy_binary_threshold_1d.h.
bool clsfy_binary_threshold_1d::operator== | ( | const clsfy_classifier_1d & | x | ) | const [virtual] |
Equality operator for 1d classifiers.
Implements clsfy_classifier_1d.
Definition at line 58 of file clsfy_binary_threshold_1d.cxx.
vnl_vector< double > clsfy_binary_threshold_1d::params | ( | ) | const [virtual] |
Return parameters defining classifier in a vector (format depends on classifier).
Implements clsfy_classifier_1d.
Definition at line 42 of file clsfy_binary_threshold_1d.cxx.
void clsfy_binary_threshold_1d::print_summary | ( | vcl_ostream & | os | ) | const [virtual] |
Print class to os.
required if data is present in this class
Implements clsfy_classifier_1d.
Definition at line 81 of file clsfy_binary_threshold_1d.cxx.
void clsfy_binary_threshold_1d::set | ( | double | s, |
double | t | ||
) | [inline] |
Set the threshold and orientation.
Definition at line 37 of file clsfy_binary_threshold_1d.h.
void clsfy_binary_threshold_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 48 of file clsfy_binary_threshold_1d.cxx.
short clsfy_binary_threshold_1d::version_no | ( | ) | const |
Version number for I/O.
Definition at line 88 of file clsfy_binary_threshold_1d.cxx.
double clsfy_binary_threshold_1d::s_ [protected] |
Definition at line 19 of file clsfy_binary_threshold_1d.h.
double clsfy_binary_threshold_1d::threshold_ [protected] |
Definition at line 20 of file clsfy_binary_threshold_1d.h.