LinearClassifier Class Reference

The LinearClassifier class is a multi class classifier model suited for linear discriminant analysis. More...

#include <LinearModel.h>

Inheritance diagram for LinearClassifier:

Model

List of all members.

Public Member Functions

 LinearClassifier (int dimension, int classes)
 ~LinearClassifier ()
void setParameter (unsigned int index, double value)
 Modifies a specific model parameter.
void model (const Array< double > &input, Array< double > &output)
 Returns the model's answer output on the stimulus input.
int getNumberOfClasses () const

Protected Attributes

int numberOfClasses
Array< double > mean
Array2D< double > covariance
Array2D< double > inverse
bool bNeedsUpdate


Detailed Description

The LinearClassifier class is a multi class classifier model suited for linear discriminant analysis.

For c classes $ 0, \dots, c-1 $ the model holds class mean vectors $ m_c $ and a shared data scatter matrix $ M $. It predicts the class of a vector x according to the rule $ \textrm{argmin}_{c} (x - m_c)^T M^{-1} (x - m_c) $. The output is a unit vector in $ R^c $ composed of zeros and a single 1 entry in the component corresponding to the predicted class.

Examples:

LinearClassifierTest.cpp.

Definition at line 126 of file LinearModel.h.


Constructor & Destructor Documentation

LinearClassifier::LinearClassifier ( int  dimension,
int  classes 
)

LinearClassifier::~LinearClassifier (  ) 

Definition at line 251 of file LinearModel.cpp.


Member Function Documentation

int LinearClassifier::getNumberOfClasses (  )  const [inline]

Definition at line 135 of file LinearModel.h.

References numberOfClasses.

Referenced by LDA::optimize().

void LinearClassifier::model ( const Array< double > &  input,
Array< double > &  output 
) [virtual]

Returns the model's answer output on the stimulus input.

This method calculates the output of the model depending on the input. The arrays input and output can either be one- or two-dimensional, depending on whether one or many patterns should be processed. The number of elements in the last dimension of these arrays must fit the inputDimension and outputDimension, in case of two-dimensional input, the number of elements in the first dimension equals the number of patterns. The method is pure virtual as it has to be implemented by the different models.

Parameters:
input Vector of input values.
output Vector of output values.
Returns:
None.

Implements Model.

Definition at line 278 of file LinearModel.cpp.

References bNeedsUpdate, covariance, i, Model::inputDimension, inverse, mean, and numberOfClasses.

void LinearClassifier::setParameter ( unsigned int  index,
double  value 
) [virtual]

Modifies a specific model parameter.

Reimplemented from Model.

Definition at line 256 of file LinearModel.cpp.

References bNeedsUpdate, covariance, Model::inputDimension, mean, and numberOfClasses.

Referenced by LDA::optimize().


Member Data Documentation

Definition at line 145 of file LinearModel.h.

Referenced by LinearClassifier(), model(), and setParameter().

Array2D<double> LinearClassifier::covariance [protected]

Definition at line 143 of file LinearModel.h.

Referenced by LinearClassifier(), model(), and setParameter().

Array2D<double> LinearClassifier::inverse [protected]

Definition at line 144 of file LinearModel.h.

Referenced by LinearClassifier(), and model().

Array<double> LinearClassifier::mean [protected]

Definition at line 142 of file LinearModel.h.

Referenced by LinearClassifier(), model(), and setParameter().

Definition at line 141 of file LinearModel.h.

Referenced by getNumberOfClasses(), LinearClassifier(), model(), and setParameter().


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