A classifier that always returns the same answer. More...
#include <clsfy_null_classifier.h>
Public Member Functions | |
clsfy_null_classifier () | |
clsfy_null_classifier (unsigned dc) | |
Constructor for when you need a different default. | |
virtual void | class_probabilities (vcl_vector< double > &outputs, const vnl_vector< double > &input) const |
Return the probability the input being in each class. | |
virtual double | log_l (const vnl_vector< double > &input) const |
Log likelihood of being in class. | |
virtual unsigned | n_classes () const |
The number of possible output classes. | |
virtual unsigned | n_dims () const |
The dimensionality of input vectors. | |
void | set_n_dims (unsigned n) |
Set the number of dimensions the classifier reports that it uses. | |
unsigned | default_class () const |
The classification result that is always returned. | |
void | set_default_class (unsigned dc) |
Set the number of dimensions the classifier reports that it uses. | |
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 |
Create a copy on the heap and return base class pointer. | |
virtual void | print_summary (vcl_ostream &os) const |
Print class to os. | |
virtual void | b_write (vsl_b_ostream &bfs) const |
Save class to binary file stream. | |
virtual void | b_read (vsl_b_istream &bfs) |
Load class from binary file stream. | |
const vcl_vector< double > & | probs () const |
The probabilities of returning a value in each class. | |
void | set_probs (const vcl_vector< double > &) |
Set the prior probabilities of each class. | |
virtual unsigned | classify (const vnl_vector< double > &input) const |
Classify the input vector. | |
virtual void | classify_many (vcl_vector< unsigned > &outputs, mbl_data_wrapper< vnl_vector< double > > &inputs) const |
Classify many input vectors. | |
Private Attributes | |
unsigned | n_dims_ |
The classifier may get asked this. | |
unsigned | default_class_ |
The class value that is always returned, whatever the input vector. |
A classifier that always returns the same answer.
Definition at line 20 of file clsfy_null_classifier.h.
clsfy_null_classifier::clsfy_null_classifier | ( | ) | [inline] |
Definition at line 24 of file clsfy_null_classifier.h.
clsfy_null_classifier::clsfy_null_classifier | ( | unsigned | dc | ) | [inline] |
Constructor for when you need a different default.
Definition at line 27 of file clsfy_null_classifier.h.
void clsfy_null_classifier::b_read | ( | vsl_b_istream & | bfs | ) | [virtual] |
Load class from binary file stream.
Implements clsfy_classifier_base.
Definition at line 61 of file clsfy_null_classifier.cxx.
void clsfy_null_classifier::b_write | ( | vsl_b_ostream & | bfs | ) | const [virtual] |
Save class to binary file stream.
Implements clsfy_classifier_base.
Definition at line 50 of file clsfy_null_classifier.cxx.
void clsfy_null_classifier::class_probabilities | ( | vcl_vector< double > & | outputs, |
const vnl_vector< double > & | input | ||
) | const [virtual] |
Return the probability the input being in each class.
output(i) i<nClasses, contains the probability that the input is in class i
Implements clsfy_classifier_base.
Definition at line 92 of file clsfy_null_classifier.cxx.
unsigned clsfy_classifier_base::classify | ( | const vnl_vector< double > & | input | ) | const [virtual, inherited] |
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, inherited] |
Classify many input vectors.
Definition at line 55 of file clsfy_classifier_base.cxx.
clsfy_classifier_base * clsfy_null_classifier::clone | ( | ) | const [virtual] |
Create a copy on the heap and return base class pointer.
Implements clsfy_classifier_base.
Definition at line 37 of file clsfy_null_classifier.cxx.
unsigned clsfy_null_classifier::default_class | ( | ) | const [inline] |
The classification result that is always returned.
Definition at line 49 of file clsfy_null_classifier.h.
vcl_string clsfy_null_classifier::is_a | ( | ) | const [virtual] |
Name of the class.
Reimplemented from clsfy_classifier_base.
Definition at line 23 of file clsfy_null_classifier.cxx.
bool clsfy_null_classifier::is_class | ( | vcl_string const & | s | ) | const [virtual] |
Name of the class.
Reimplemented from clsfy_classifier_base.
Definition at line 30 of file clsfy_null_classifier.cxx.
double clsfy_null_classifier::log_l | ( | const vnl_vector< double > & | input | ) | const [virtual] |
Log likelihood of being in class.
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.
Implements clsfy_classifier_base.
Definition at line 105 of file clsfy_null_classifier.cxx.
unsigned clsfy_null_classifier::n_classes | ( | ) | const [virtual] |
The number of possible output classes.
Implements clsfy_classifier_base.
Definition at line 83 of file clsfy_null_classifier.cxx.
virtual unsigned clsfy_null_classifier::n_dims | ( | ) | const [inline, virtual] |
The dimensionality of input vectors.
Implements clsfy_classifier_base.
Definition at line 39 of file clsfy_null_classifier.h.
void clsfy_null_classifier::print_summary | ( | vcl_ostream & | os | ) | const [virtual] |
Print class to os.
Implements clsfy_classifier_base.
Definition at line 44 of file clsfy_null_classifier.cxx.
const vcl_vector<double>& clsfy_null_classifier::probs | ( | ) | const |
The probabilities of returning a value in each class.
void clsfy_null_classifier::set_default_class | ( | unsigned | dc | ) | [inline] |
Set the number of dimensions the classifier reports that it uses.
The classifier itself pays no attention to this value, but it may be useful for other error checking code which calls n_dims()
Definition at line 55 of file clsfy_null_classifier.h.
void clsfy_null_classifier::set_n_dims | ( | unsigned | n | ) | [inline] |
Set the number of dimensions the classifier reports that it uses.
The classifier itself pays no attention to this value, but it may be useful for other error checking code which calls n_dims()
Definition at line 45 of file clsfy_null_classifier.h.
void clsfy_null_classifier::set_probs | ( | const vcl_vector< double > & | ) |
Set the prior probabilities of each class.
The values are normalised to sum to 1.
unsigned clsfy_null_classifier::default_class_ [private] |
The class value that is always returned, whatever the input vector.
Definition at line 90 of file clsfy_null_classifier.h.
unsigned clsfy_null_classifier::n_dims_ [private] |
The classifier may get asked this.
Definition at line 87 of file clsfy_null_classifier.h.