Public Member Functions | Static Public Member Functions | Private Attributes
clsfy_null_builder Class Reference

Builds clsfy_null_classifier. More...

#include <clsfy_null_builder.h>

Inheritance diagram for clsfy_null_builder:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 clsfy_null_builder ()
virtual clsfy_classifier_basenew_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_baseclone () 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.

Detailed Description

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.


Constructor & Destructor Documentation

clsfy_null_builder::clsfy_null_builder ( ) [inline]

Definition at line 33 of file clsfy_null_builder.h.


Member Function Documentation

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)
   }
   
Exceptions:
mbl_exception_parse_errorif 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.

Exceptions:
ifthe 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.


Member Data Documentation

The classification result to always return.

Definition at line 29 of file clsfy_null_builder.h.


The documentation for this class was generated from the following files: