Public Member Functions | Protected Attributes
clsfy_binary_hyperplane Class Reference

A binary output hyperplane classifier. More...

#include <clsfy_binary_hyperplane.h>

Inheritance diagram for clsfy_binary_hyperplane:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual void class_probabilities (vcl_vector< double > &outputs, const vnl_vector< double > &input) const
 Find the posterior probability of the input being in the positive class.
virtual unsigned classify (const vnl_vector< double > &input) const
 Classify the input vector.
virtual double log_l (const vnl_vector< double > &input) const
 Log likelihood of being in the positive class.
void set (const vnl_vector< double > &weights, double bias)
 Set the position of the hyperplane.
const vnl_vector< double > & weights () const
 Get the classifier weight vector (= hyperplane normal).
double bias () const
 Get the classifier bias.
virtual unsigned n_dims () const
 The dimensionality of input vectors.
virtual unsigned n_classes () const
 The number of possible output classes.
short version_no () const
 Version number for I/O.
virtual vcl_string is_a () const
 Name of the class.
virtual bool is_class (vcl_string const &s) const
 Name of the class.
virtual void print_summary (vcl_ostream &os) const
 Print class to os.
virtual void b_write (vsl_b_ostream &bfs) const
 Save class to a binary File Stream.
virtual clsfy_classifier_baseclone () const
 Create a deep copy.
virtual void b_read (vsl_b_istream &bfs)
 Load the class from a Binary File Stream.
virtual void classify_many (vcl_vector< unsigned > &outputs, mbl_data_wrapper< vnl_vector< double > > &inputs) const
 Classify many input vectors.

Protected Attributes

vnl_vector< double > weights_
 Hyperplane normal.
double bias_
 Bias: ||weights_|| * distance from origin to hyperplane.

Detailed Description

A binary output hyperplane classifier.

The classifier could be considered as a single perceptron.

Definition at line 18 of file clsfy_binary_hyperplane.h.


Member Function Documentation

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

Load the class from a Binary File Stream.

Implements clsfy_classifier_base.

Definition at line 95 of file clsfy_binary_hyperplane.cxx.

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

Save class to a binary File Stream.

Implements clsfy_classifier_base.

Definition at line 86 of file clsfy_binary_hyperplane.cxx.

double clsfy_binary_hyperplane::bias ( ) const [inline]

Get the classifier bias.

Definition at line 50 of file clsfy_binary_hyperplane.h.

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

Find the posterior probability of the input being in the positive class.

The result is outputs(0)

Implements clsfy_classifier_base.

Definition at line 34 of file clsfy_binary_hyperplane.cxx.

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

Classify the input vector.

Returns a number between 0 and nClasses-1 inclusive to represent the most likely class

Returns either 0 (for negative class) or 1 (for positive class)

Reimplemented from clsfy_classifier_base.

Definition at line 23 of file clsfy_binary_hyperplane.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.

virtual clsfy_classifier_base* clsfy_binary_hyperplane::clone ( ) const [inline, virtual]

Create a deep copy.

Client is responsible for deleting returned object.

Implements clsfy_classifier_base.

Definition at line 76 of file clsfy_binary_hyperplane.h.

vcl_string clsfy_binary_hyperplane::is_a ( ) const [virtual]

Name of the class.

Reimplemented from clsfy_classifier_base.

Definition at line 55 of file clsfy_binary_hyperplane.cxx.

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

Name of the class.

Reimplemented from clsfy_classifier_base.

Definition at line 62 of file clsfy_binary_hyperplane.cxx.

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

Log likelihood of being in the positive class.

Class probability = 1 / (1+exp(-log_l))

Implements clsfy_classifier_base.

Definition at line 46 of file clsfy_binary_hyperplane.cxx.

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

The number of possible output classes.

1 indicates a binary classifier

Implements clsfy_classifier_base.

Definition at line 57 of file clsfy_binary_hyperplane.h.

virtual unsigned clsfy_binary_hyperplane::n_dims ( ) const [inline, virtual]

The dimensionality of input vectors.

Implements clsfy_classifier_base.

Definition at line 53 of file clsfy_binary_hyperplane.h.

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

Print class to os.

required if data is present in this class

Implements clsfy_classifier_base.

Definition at line 71 of file clsfy_binary_hyperplane.cxx.

void clsfy_binary_hyperplane::set ( const vnl_vector< double > &  weights,
double  bias 
) [inline]

Set the position of the hyperplane.

The object will take and maintain its own deep copy of the data. This method should only be used by builders.

Definition at line 43 of file clsfy_binary_hyperplane.h.

short clsfy_binary_hyperplane::version_no ( ) const

Version number for I/O.

Definition at line 79 of file clsfy_binary_hyperplane.cxx.

const vnl_vector<double>& clsfy_binary_hyperplane::weights ( ) const [inline]

Get the classifier weight vector (= hyperplane normal).

Definition at line 47 of file clsfy_binary_hyperplane.h.


Member Data Documentation

double clsfy_binary_hyperplane::bias_ [protected]

Bias: ||weights_|| * distance from origin to hyperplane.

Definition at line 24 of file clsfy_binary_hyperplane.h.

Hyperplane normal.

Definition at line 22 of file clsfy_binary_hyperplane.h.


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