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

Builder for linear 2-state classifier. More...

#include <clsfy_binary_hyperplane_gmrho_builder.h>

Inheritance diagram for clsfy_binary_hyperplane_gmrho_builder:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 clsfy_binary_hyperplane_gmrho_builder ()
double build (clsfy_classifier_base &classifier, mbl_data_wrapper< vnl_vector< double > > &inputs, const vcl_vector< unsigned > &outputs) const
 Build a linear classifier, with the given data.
virtual double build (clsfy_classifier_base &model, mbl_data_wrapper< vnl_vector< double > > &inputs, unsigned nClasses, const vcl_vector< unsigned > &outputs) const
 Build model from data.
short version_no () const
 Version number for I/O.
vcl_string is_a () const
 Name of the class.
virtual bool is_class (vcl_string const &s) const
 Name of the class.
void print_summary (vcl_ostream &os) const
 Print class to os.
virtual clsfy_builder_baseclone () const
 Create a deep copy.
void set_auto_estimate_sigma (bool bAuto)
 should sigma be estimate during the build or a pre-defined value used.
void set_sigma_preset (double sigma_preset)
 use this for sigma if auto_estimate_sigma is true.
virtual void b_write (vsl_b_ostream &) const
 Save class to binary file stream.
virtual void b_read (vsl_b_istream &)
 Load class from binary file stream.
virtual clsfy_classifier_basenew_classifier () const
 Create a new untrained linear classifier with binary output.
virtual 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 Member Functions

double estimate_sigma (const vnl_matrix< double > &data, const vnl_vector< double > &y) const
 Estimate the scale (sigma) used in the Geman-McClure function.
void determine_weights (const vnl_matrix< double > &data, const vnl_vector< double > &y, double sigma) const
 Determine the weights for the hyperplane.

Private Attributes

vnl_vector< double > weights_
 The classifier weights (weight N is the constant).
unsigned num_examples_
 Number of training examples (data.rows()).
unsigned num_vars_
 Number of variables (data.cols()).
double epsilon_
 Tolerance for non-linear optimiser convergence.
bool auto_estimate_sigma_
 should sigma be estimated during the build or a pre-defined value used.
double sigma_preset_
 use this for sigma if auto_estimate_sigma is true.

Detailed Description

Builder for linear 2-state classifier.

Uses a Geman-McClure robust function, rather than a least squares fit, on points that are not mis-classified This increases the weighting given to points near the boundary in determining its fit A conventional least squares fit is perform first to determine a starting solution, and also the sigma scaling factor used in the GM function. Several iterations are performed during which sigma is reduced (i.e. deterministic annealing), to try and avoid local minima

Definition at line 29 of file clsfy_binary_hyperplane_gmrho_builder.h.


Constructor & Destructor Documentation

clsfy_binary_hyperplane_gmrho_builder::clsfy_binary_hyperplane_gmrho_builder ( ) [inline]

Definition at line 58 of file clsfy_binary_hyperplane_gmrho_builder.h.


Member Function Documentation

void clsfy_binary_hyperplane_gmrho_builder::b_read ( vsl_b_istream bfs) [virtual]

Load class from binary file stream.

Reimplemented from clsfy_binary_hyperplane_ls_builder.

Definition at line 274 of file clsfy_binary_hyperplane_gmrho_builder.cxx.

void clsfy_binary_hyperplane_gmrho_builder::b_write ( vsl_b_ostream bfs) const [virtual]

Save class to binary file stream.

Reimplemented from clsfy_binary_hyperplane_ls_builder.

Definition at line 265 of file clsfy_binary_hyperplane_gmrho_builder.cxx.

double clsfy_binary_hyperplane_gmrho_builder::build ( clsfy_classifier_base classifier,
mbl_data_wrapper< vnl_vector< double > > &  inputs,
const vcl_vector< unsigned > &  outputs 
) const

Build a linear classifier, with the given data.

Build a linear hyperplane classifier with the given data.

Return the mean error over the training set.

Reduce the influence of well classified points far into their correct region by applying a Geman-McClure robust error function, rather than a least squares fit

Reimplemented from clsfy_binary_hyperplane_ls_builder.

Definition at line 110 of file clsfy_binary_hyperplane_gmrho_builder.cxx.

double clsfy_binary_hyperplane_gmrho_builder::build ( clsfy_classifier_base classifier,
mbl_data_wrapper< vnl_vector< double > > &  inputs,
unsigned  n_classes,
const vcl_vector< unsigned > &  outputs 
) const [virtual]

Build model from data.

Build a linear classifier, with the given data.

Return the mean error over the training set. For this classifiers, you must nClasses==1 to indicate a binary classifier

Return the mean error over the training set. n_classes must be 1.

Reimplemented from clsfy_binary_hyperplane_ls_builder.

Definition at line 98 of file clsfy_binary_hyperplane_gmrho_builder.cxx.

clsfy_builder_base * clsfy_binary_hyperplane_gmrho_builder::clone ( ) const [virtual]

Create a deep copy.

client is responsible for deleting returned object.

Reimplemented from clsfy_binary_hyperplane_ls_builder.

Definition at line 321 of file clsfy_binary_hyperplane_gmrho_builder.cxx.

void clsfy_builder_base::config ( vcl_istream &  as) [virtual, inherited]

Initialise the parameters from a text stream.

Default case accepts no parameters.

Reimplemented in clsfy_rbf_svm_smo_1_builder, clsfy_parzen_builder, clsfy_knn_builder, clsfy_null_builder, and clsfy_binary_1d_wrapper_builder.

Definition at line 26 of file clsfy_builder_base.cxx.

void clsfy_binary_hyperplane_gmrho_builder::determine_weights ( const vnl_matrix< double > &  data,
const vnl_vector< double > &  y,
double  sigma 
) const [private]

Determine the weights for the hyperplane.

Definition at line 194 of file clsfy_binary_hyperplane_gmrho_builder.cxx.

double clsfy_binary_hyperplane_gmrho_builder::estimate_sigma ( const vnl_matrix< double > &  data,
const vnl_vector< double > &  y 
) const [private]

Estimate the scale (sigma) used in the Geman-McClure function.

This is increased by the mis-classification overlap region if any

Definition at line 211 of file clsfy_binary_hyperplane_gmrho_builder.cxx.

vcl_string clsfy_binary_hyperplane_gmrho_builder::is_a ( ) const [virtual]

Name of the class.

Reimplemented from clsfy_binary_hyperplane_ls_builder.

Definition at line 294 of file clsfy_binary_hyperplane_gmrho_builder.cxx.

bool clsfy_binary_hyperplane_gmrho_builder::is_class ( vcl_string const &  s) const [virtual]

Name of the class.

Reimplemented from clsfy_binary_hyperplane_ls_builder.

Definition at line 301 of file clsfy_binary_hyperplane_gmrho_builder.cxx.

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.

virtual clsfy_classifier_base* clsfy_binary_hyperplane_ls_builder::new_classifier ( ) const [inline, virtual, inherited]

Create a new untrained linear classifier with binary output.

Implements clsfy_builder_base.

Definition at line 23 of file clsfy_binary_hyperplane_ls_builder.h.

void clsfy_binary_hyperplane_gmrho_builder::print_summary ( vcl_ostream &  os) const [virtual]

Print class to os.

Reimplemented from clsfy_binary_hyperplane_ls_builder.

Definition at line 315 of file clsfy_binary_hyperplane_gmrho_builder.cxx.

void clsfy_binary_hyperplane_gmrho_builder::set_auto_estimate_sigma ( bool  bAuto) [inline]

should sigma be estimate during the build or a pre-defined value used.

Definition at line 95 of file clsfy_binary_hyperplane_gmrho_builder.h.

void clsfy_binary_hyperplane_gmrho_builder::set_sigma_preset ( double  sigma_preset) [inline]

use this for sigma if auto_estimate_sigma is true.

Definition at line 97 of file clsfy_binary_hyperplane_gmrho_builder.h.

short clsfy_binary_hyperplane_gmrho_builder::version_no ( ) const

Version number for I/O.

Definition at line 308 of file clsfy_binary_hyperplane_gmrho_builder.cxx.


Member Data Documentation

should sigma be estimated during the build or a pre-defined value used.

Definition at line 43 of file clsfy_binary_hyperplane_gmrho_builder.h.

Tolerance for non-linear optimiser convergence.

Definition at line 40 of file clsfy_binary_hyperplane_gmrho_builder.h.

Number of training examples (data.rows()).

Definition at line 36 of file clsfy_binary_hyperplane_gmrho_builder.h.

Number of variables (data.cols()).

Definition at line 38 of file clsfy_binary_hyperplane_gmrho_builder.h.

use this for sigma if auto_estimate_sigma is true.

Definition at line 45 of file clsfy_binary_hyperplane_gmrho_builder.h.

The classifier weights (weight N is the constant).

Definition at line 33 of file clsfy_binary_hyperplane_gmrho_builder.h.


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