Builds clsfy_null_classifier. More...
#include <clsfy_null_builder.h>
Public Member Functions | |
clsfy_null_builder () | |
virtual clsfy_classifier_base * | new_classifier () const |
Create empty model. | |
virtual double | build (clsfy_classifier_base &model, mbl_data_wrapper< vnl_vector< double > > &inputs, unsigned nClasses, const vcl_vector< unsigned > &outputs) const |
Build classifier from data. | |
virtual vcl_string | is_a () const |
Name of the class. | |
virtual bool | is_class (vcl_string const &s) const |
Name of the class. | |
short | version_no () const |
IO Version number. | |
virtual clsfy_builder_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. | |
unsigned | k () const |
The number of nearest neighbours to look for. | |
void | set_k (unsigned) |
Set the number of nearest neighbours to look for. | |
void | config (vcl_istream &as) |
Initialise the parameters from a text stream. | |
Static Public Member Functions | |
static vcl_auto_ptr < clsfy_builder_base > | new_builder (vcl_istream &as) |
Load description from a text stream. | |
Private Attributes | |
unsigned | default_class_ |
The classification result to always return. |
Builds clsfy_null_classifier.
This class doesn't do any calculation, it is easy to create a null classifier directly - but it allows for consistent swappable classifiers.
Definition at line 26 of file clsfy_null_builder.h.
clsfy_null_builder::clsfy_null_builder | ( | ) | [inline] |
Definition at line 33 of file clsfy_null_builder.h.
void clsfy_null_builder::b_read | ( | vsl_b_istream & | bfs | ) | [virtual] |
Load class from binary file stream.
Implements clsfy_builder_base.
Definition at line 63 of file clsfy_null_builder.cxx.
void clsfy_null_builder::b_write | ( | vsl_b_ostream & | bfs | ) | const [virtual] |
Save class to binary file stream.
Implements clsfy_builder_base.
Definition at line 54 of file clsfy_null_builder.cxx.
double clsfy_null_builder::build | ( | clsfy_classifier_base & | model, |
mbl_data_wrapper< vnl_vector< double > > & | inputs, | ||
unsigned | nClasses, | ||
const vcl_vector< unsigned > & | outputs | ||
) | const [virtual] |
Build classifier from data.
Build model from data.
return the mean error over the training set.
return the mean error over the training set. For many classifiers, you may use nClasses==1 to indicate a binary classifier
Implements clsfy_builder_base.
Definition at line 87 of file clsfy_null_builder.cxx.
clsfy_builder_base * clsfy_null_builder::clone | ( | ) | const [virtual] |
Create a copy on the heap and return base class pointer.
Implements clsfy_builder_base.
Definition at line 40 of file clsfy_null_builder.cxx.
void clsfy_null_builder::config | ( | vcl_istream & | as | ) | [virtual] |
Initialise the parameters from a text stream.
The next non-ws character in the stream should be a '{'
{ default_class: 1 (default 0) }
mbl_exception_parse_error | if the parse fails. |
Reimplemented from clsfy_builder_base.
Definition at line 118 of file clsfy_null_builder.cxx.
vcl_string clsfy_null_builder::is_a | ( | ) | const [virtual] |
Name of the class.
Reimplemented from clsfy_builder_base.
Definition at line 26 of file clsfy_null_builder.cxx.
bool clsfy_null_builder::is_class | ( | vcl_string const & | s | ) | const [virtual] |
Name of the class.
Reimplemented from clsfy_builder_base.
Definition at line 33 of file clsfy_null_builder.cxx.
unsigned clsfy_null_builder::k | ( | ) | const |
The number of nearest neighbours to look for.
vcl_auto_ptr< clsfy_builder_base > clsfy_builder_base::new_builder | ( | vcl_istream & | as | ) | [static, inherited] |
Load description from a text stream.
The stream should contain the name of the feature extractor class that will be used, followed by a brace-enclosed list of parameters for the builder. This function will construct the appropriate clsfy_builder_base derivative and return that.
if | the parse fails. |
Definition at line 42 of file clsfy_builder_base.cxx.
clsfy_classifier_base * clsfy_null_builder::new_classifier | ( | ) | const [virtual] |
Create empty model.
Create empty classifier.
Caller is responsible for deletion
Implements clsfy_builder_base.
Definition at line 104 of file clsfy_null_builder.cxx.
void clsfy_null_builder::print_summary | ( | vcl_ostream & | os | ) | const [virtual] |
Print class to os.
Implements clsfy_builder_base.
Definition at line 47 of file clsfy_null_builder.cxx.
void clsfy_null_builder::set_k | ( | unsigned | ) |
Set the number of nearest neighbours to look for.
short clsfy_null_builder::version_no | ( | ) | const |
IO Version number.
unsigned clsfy_null_builder::default_class_ [private] |
The classification result to always return.
Definition at line 29 of file clsfy_null_builder.h.