Decisions are based on an explicit multivariate probability distribution. More...
#include <clsfy_binary_pdf_classifier.h>
Public Member Functions | |
clsfy_binary_pdf_classifier () | |
clsfy_binary_pdf_classifier (const vpdfl_pdf_base &pdf, double log_prob_limit) | |
A useful constructor. | |
~clsfy_binary_pdf_classifier () | |
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 |
Return the probability the input being in class 0. | |
double | log_l (const vnl_vector< double > &input) const |
Log likelihood of being in class 0, i.e. const + log(P(class=0|data)). | |
void | set_log_prob_limit (double limit) |
Set the log probability density limit,. | |
double | log_prob_limit () const |
The log probability density limit,. | |
void | set_pdf (const vpdfl_pdf_base &pdf) |
Set the PDF. | |
bool | has_pdf () const |
const vpdfl_pdf_base & | pdf () const |
Get the internal PDFs. | |
virtual unsigned | n_dims () const |
The dimensionality of input vectors. | |
virtual unsigned | n_classes () const |
The number of possible output classes. | |
clsfy_classifier_base * | clone () const |
Produce a deep copy. | |
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 void | b_read (vsl_b_istream &bfs) |
Load the class from a Binary File Stream. | |
clsfy_binary_pdf_classifier (const clsfy_binary_pdf_classifier &b) | |
clsfy_binary_pdf_classifier & | operator= (const clsfy_binary_pdf_classifier &classifier) |
Assignment operator. | |
virtual void | classify_many (vcl_vector< unsigned > &outputs, mbl_data_wrapper< vnl_vector< double > > &inputs) const |
Classify many input vectors. | |
Protected Member Functions | |
void | deleteStuff () |
Protected Attributes | |
vpdfl_pdf_base * | pdf_ |
The current distribution model. | |
double | log_prob_limit_ |
The value of log probability density marking the class boundary. |
Decisions are based on an explicit multivariate probability distribution.
Definition at line 16 of file clsfy_binary_pdf_classifier.h.
clsfy_binary_pdf_classifier::clsfy_binary_pdf_classifier | ( | ) | [inline] |
Definition at line 29 of file clsfy_binary_pdf_classifier.h.
clsfy_binary_pdf_classifier::clsfy_binary_pdf_classifier | ( | const vpdfl_pdf_base & | pdf, |
double | log_prob_limit | ||
) | [inline] |
A useful constructor.
Specify the log probability density limit
Definition at line 33 of file clsfy_binary_pdf_classifier.h.
clsfy_binary_pdf_classifier::~clsfy_binary_pdf_classifier | ( | ) | [inline] |
Definition at line 38 of file clsfy_binary_pdf_classifier.h.
clsfy_binary_pdf_classifier::clsfy_binary_pdf_classifier | ( | const clsfy_binary_pdf_classifier & | b | ) | [inline] |
Definition at line 119 of file clsfy_binary_pdf_classifier.h.
void clsfy_binary_pdf_classifier::b_read | ( | vsl_b_istream & | bfs | ) | [virtual] |
Load the class from a Binary File Stream.
Implements clsfy_classifier_base.
Definition at line 134 of file clsfy_binary_pdf_classifier.cxx.
void clsfy_binary_pdf_classifier::b_write | ( | vsl_b_ostream & | bfs | ) | const [virtual] |
Save class to a binary File Stream.
Implements clsfy_classifier_base.
Definition at line 125 of file clsfy_binary_pdf_classifier.cxx.
void clsfy_binary_pdf_classifier::class_probabilities | ( | vcl_vector< double > & | outputs, |
const vnl_vector< double > & | input | ||
) | const [virtual] |
Return the probability the input being in class 0.
Return the probability the input being in each class P(class|data).
output(0) contains the probability that the input is in class 1
output(i) i<n_classes, contains the probability that the input is in class i
Implements clsfy_classifier_base.
Definition at line 42 of file clsfy_binary_pdf_classifier.cxx.
unsigned clsfy_binary_pdf_classifier::classify | ( | const vnl_vector< double > & | input | ) | const [virtual] |
Classify the input vector.
Returns either class1 (Inside PDF mode) or class 0 (Outside PDF mode).
Reimplemented from clsfy_classifier_base.
Definition at line 27 of file clsfy_binary_pdf_classifier.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_pdf_classifier::clone | ( | ) | const [virtual] |
Produce a deep copy.
client has responsibility for deletion.
Implements clsfy_classifier_base.
Definition at line 99 of file clsfy_binary_pdf_classifier.cxx.
void clsfy_binary_pdf_classifier::deleteStuff | ( | ) | [protected] |
Definition at line 17 of file clsfy_binary_pdf_classifier.cxx.
bool clsfy_binary_pdf_classifier::has_pdf | ( | ) | const [inline] |
Definition at line 76 of file clsfy_binary_pdf_classifier.h.
vcl_string clsfy_binary_pdf_classifier::is_a | ( | ) | const [virtual] |
Name of the class.
Reimplemented from clsfy_classifier_base.
Definition at line 70 of file clsfy_binary_pdf_classifier.cxx.
bool clsfy_binary_pdf_classifier::is_class | ( | vcl_string const & | s | ) | const [virtual] |
Name of the class.
Reimplemented from clsfy_classifier_base.
Definition at line 77 of file clsfy_binary_pdf_classifier.cxx.
double clsfy_binary_pdf_classifier::log_l | ( | const vnl_vector< double > & | input | ) | const [virtual] |
Log likelihood of being in class 0, i.e. const + log(P(class=0|data)).
Log likelihood of being in class 0. log(P(class=0|data)).
The constant is chosen such that the decision boundary is at logL ==0; This function is intended for binary classifiers only. logL is related to class probability as P(class=0|data) = exp(logL) / (1+exp(logL))
This function is intended for use in binary classifiers only. It is related to the class 0 probability as follows, P(class=0|data) = exp(logL) / (1+exp(logL)). Don't forget that P(X|data) is a density and so the result can be greater than 1.0 or less than 0.0, (or indeed between 0.0 and 1.0).
Implements clsfy_classifier_base.
Definition at line 60 of file clsfy_binary_pdf_classifier.cxx.
double clsfy_binary_pdf_classifier::log_prob_limit | ( | ) | const [inline] |
The log probability density limit,.
above which the inputs are in class 1.
Definition at line 63 of file clsfy_binary_pdf_classifier.h.
virtual unsigned clsfy_binary_pdf_classifier::n_classes | ( | ) | const [inline, virtual] |
The number of possible output classes.
Implements clsfy_classifier_base.
Definition at line 92 of file clsfy_binary_pdf_classifier.h.
virtual unsigned clsfy_binary_pdf_classifier::n_dims | ( | ) | const [inline, virtual] |
The dimensionality of input vectors.
Implements clsfy_classifier_base.
Definition at line 89 of file clsfy_binary_pdf_classifier.h.
clsfy_binary_pdf_classifier & clsfy_binary_pdf_classifier::operator= | ( | const clsfy_binary_pdf_classifier & | classifier | ) |
Assignment operator.
Definition at line 106 of file clsfy_binary_pdf_classifier.cxx.
const vpdfl_pdf_base& clsfy_binary_pdf_classifier::pdf | ( | ) | const [inline] |
Get the internal PDFs.
The object will return a reference to the internal data.
Definition at line 82 of file clsfy_binary_pdf_classifier.h.
void clsfy_binary_pdf_classifier::print_summary | ( | vcl_ostream & | os | ) | const [virtual] |
Print class to os.
Implements clsfy_classifier_base.
Definition at line 92 of file clsfy_binary_pdf_classifier.cxx.
void clsfy_binary_pdf_classifier::set_log_prob_limit | ( | double | limit | ) | [inline] |
Set the log probability density limit,.
above which the inputs are in class 1.
Definition at line 56 of file clsfy_binary_pdf_classifier.h.
void clsfy_binary_pdf_classifier::set_pdf | ( | const vpdfl_pdf_base & | ) | [inline] |
Set the PDF.
The class takes its own deep copy of the PDF.
Definition at line 70 of file clsfy_binary_pdf_classifier.h.
short clsfy_binary_pdf_classifier::version_no | ( | ) | const |
Version number for I/O.
Definition at line 84 of file clsfy_binary_pdf_classifier.cxx.
double clsfy_binary_pdf_classifier::log_prob_limit_ [protected] |
The value of log probability density marking the class boundary.
Above this value the answer is 1, and below it is 0
Definition at line 24 of file clsfy_binary_pdf_classifier.h.
vpdfl_pdf_base* clsfy_binary_pdf_classifier::pdf_ [protected] |
The current distribution model.
Definition at line 20 of file clsfy_binary_pdf_classifier.h.