Public Member Functions | Private Attributes
clsfy_rbf_parzen Class Reference

A Parzen binary classifier using an RBF Window. More...

#include <clsfy_rbf_parzen.h>

Inheritance diagram for clsfy_rbf_parzen:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 clsfy_rbf_parzen ()
 Construct a Parzen classifier.
virtual unsigned classify (const vnl_vector< double > &input) const
 Return the classification of the given probe vector.
virtual void class_probabilities (vcl_vector< double > &outputs, const vnl_vector< double > &input) const
 Provides a probability-like value that the input being in each class.
double weightings (const vnl_vector< double > &input) const
 Return the number of proximate training vectors, weighted by the windowing function.
virtual double log_l (const vnl_vector< double > &input) const
 This value has properties of a Log likelihood of being in class (binary classifiers only).
void set (const vcl_vector< vnl_vector< double > > &inputs, const vcl_vector< unsigned > &outputs)
 Set the training data.
double rbf_width () const
 The 1st standard deviation width of the RBF window.
void set_rbf_width (double sigma)
 Set the 1st standard deviation width of the RBF window.
double power () const
 The value p in the window function $exp(-1/(2*sigma^p) * |x-y|^p)$.
void set_power (double p)
 The value p in the window function $exp(-1/(2*sigma^p) * |x-y|^p)$.
const vcl_vector< vnl_vector
< double > > & 
training_vectors () const
 Return a reference to the training vectors.
const vcl_vector< unsigned > & training_classes () const
 Return a reference to the training classes.
virtual unsigned n_classes () const
 The number of possible output classes.
virtual unsigned n_dims () const
 The dimensionality of input vectors.
virtual short version_no () const
 Storage version number.
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_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.
virtual void classify_many (vcl_vector< unsigned > &outputs, mbl_data_wrapper< vnl_vector< double > > &inputs) const
 Classify many input vectors.

Private Attributes

double gamma_
 Workspace value which is cached for speed.
double width_
 Width of the rbf window function.
double power_
 The power, p, in the window function. Default value is 2.0.
vcl_vector< vnl_vector< double > > trainInputs_
 The set of training input values. Size should equal number of outputs.
vcl_vector< unsigned > trainOutputs_
 The set of training output values. Size should equal number of inputs.

Detailed Description

A Parzen binary classifier using an RBF Window.

A given vector, x0, is classified, by placing a window defined by w = exp(-1/(2*sigma^p) * |x-x0|^p), and finding the majority prediction of the nearby training vectors, each weighted by the window function.

Definition at line 21 of file clsfy_rbf_parzen.h.


Constructor & Destructor Documentation

clsfy_rbf_parzen::clsfy_rbf_parzen ( ) [inline]

Construct a Parzen classifier.

Definition at line 45 of file clsfy_rbf_parzen.h.


Member Function Documentation

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

Load class from binary file stream.

Implements clsfy_classifier_base.

Definition at line 205 of file clsfy_rbf_parzen.cxx.

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

Save class to binary file stream.

Implements clsfy_classifier_base.

Definition at line 194 of file clsfy_rbf_parzen.cxx.

void clsfy_rbf_parzen::class_probabilities ( vcl_vector< double > &  outputs,
const vnl_vector< double > &  input 
) const [virtual]

Provides a probability-like value that the input being in each class.

Return a probability like value that the input being in each class.

output(i) i<nClasses, contains the probability that the input is in class i

output(i) i<<nClasses, contains the probability that the input is in class i

Implements clsfy_classifier_base.

Definition at line 60 of file clsfy_rbf_parzen.cxx.

unsigned clsfy_rbf_parzen::classify ( const vnl_vector< double > &  input) const [virtual]

Return the classification of the given probe vector.

Reimplemented from clsfy_classifier_base.

Definition at line 18 of file clsfy_rbf_parzen.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_rbf_parzen::clone ( ) const [virtual]

Create a copy on the heap and return base class pointer.

Implements clsfy_classifier_base.

Definition at line 179 of file clsfy_rbf_parzen.cxx.

vcl_string clsfy_rbf_parzen::is_a ( ) const [virtual]

Name of the class.

Reimplemented from clsfy_classifier_base.

Definition at line 158 of file clsfy_rbf_parzen.cxx.

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

Name of the class.

Reimplemented from clsfy_classifier_base.

Definition at line 165 of file clsfy_rbf_parzen.cxx.

double clsfy_rbf_parzen::log_l ( const vnl_vector< double > &  input) const [virtual]

This value has properties of a Log likelihood of being in class (binary classifiers only).

class probability = exp(logL) / (1+exp(logL))

Implements clsfy_classifier_base.

Definition at line 124 of file clsfy_rbf_parzen.cxx.

virtual unsigned clsfy_rbf_parzen::n_classes ( ) const [inline, virtual]

The number of possible output classes.

Implements clsfy_classifier_base.

Definition at line 96 of file clsfy_rbf_parzen.h.

unsigned clsfy_rbf_parzen::n_dims ( ) const [virtual]

The dimensionality of input vectors.

Implements clsfy_classifier_base.

Definition at line 113 of file clsfy_rbf_parzen.cxx.

double clsfy_rbf_parzen::power ( ) const [inline]

The value p in the window function $exp(-1/(2*sigma^p) * |x-y|^p)$.

The value p affects the kurtosis, or peakyness of the window. Towards 0 gives a more peaked central spike, and longer tail. Toward +inf gives a broader peak, and shorter tail. The default value is 2, giving a Gaussian distribution.

Definition at line 76 of file clsfy_rbf_parzen.h.

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

Print class to os.

Implements clsfy_classifier_base.

Definition at line 186 of file clsfy_rbf_parzen.cxx.

double clsfy_rbf_parzen::rbf_width ( ) const [inline]

The 1st standard deviation width of the RBF window.

The default value is 1.

Definition at line 66 of file clsfy_rbf_parzen.h.

void clsfy_rbf_parzen::set ( const vcl_vector< vnl_vector< double > > &  inputs,
const vcl_vector< unsigned > &  outputs 
)

Set the training data.

Definition at line 48 of file clsfy_rbf_parzen.cxx.

void clsfy_rbf_parzen::set_power ( double  p)

The value p in the window function $exp(-1/(2*sigma^p) * |x-y|^p)$.

The value p affects the kurtosis, or peakyness of the window. Towards 0 gives a more peaked central spike, and longer tail. Toward +inf gives a broader peak, and shorter tail. The default value is 2, giving a Gaussian distribution.

Definition at line 149 of file clsfy_rbf_parzen.cxx.

void clsfy_rbf_parzen::set_rbf_width ( double  sigma)

Set the 1st standard deviation width of the RBF window.

The default value in the constructor is 1.

The default value is 1. Really this could be better named as the RBF radius.

Definition at line 135 of file clsfy_rbf_parzen.cxx.

const vcl_vector<unsigned >& clsfy_rbf_parzen::training_classes ( ) const [inline]

Return a reference to the training classes.

Vectors are ordered similarly to training_vectors()

Definition at line 92 of file clsfy_rbf_parzen.h.

const vcl_vector<vnl_vector<double> >& clsfy_rbf_parzen::training_vectors ( ) const [inline]

Return a reference to the training vectors.

Vectors are ordered similarly to training_classes()

Definition at line 87 of file clsfy_rbf_parzen.h.

short clsfy_rbf_parzen::version_no ( ) const [virtual]

Storage version number.

Definition at line 172 of file clsfy_rbf_parzen.cxx.

double clsfy_rbf_parzen::weightings ( const vnl_vector< double > &  input) const

Return the number of proximate training vectors, weighted by the windowing function.

Return the number of training vectors weighted by the windowing function.

Definition at line 92 of file clsfy_rbf_parzen.cxx.


Member Data Documentation

double clsfy_rbf_parzen::gamma_ [private]

Workspace value which is cached for speed.

Inversely proportional to width of the RBF window function. Default value is -0.5.

width_ = 1/sqrt(-2*gamma_)

Definition at line 27 of file clsfy_rbf_parzen.h.

double clsfy_rbf_parzen::power_ [private]

The power, p, in the window function. Default value is 2.0.

Definition at line 35 of file clsfy_rbf_parzen.h.

vcl_vector<vnl_vector<double> > clsfy_rbf_parzen::trainInputs_ [private]

The set of training input values. Size should equal number of outputs.

Definition at line 38 of file clsfy_rbf_parzen.h.

vcl_vector<unsigned> clsfy_rbf_parzen::trainOutputs_ [private]

The set of training output values. Size should equal number of inputs.

Definition at line 41 of file clsfy_rbf_parzen.h.

double clsfy_rbf_parzen::width_ [private]

Width of the rbf window function.

Default value is 1.0. width_ = 1/sqrt(-2*gamma_)

Definition at line 32 of file clsfy_rbf_parzen.h.


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