The LinearClassifier class is a multi class classifier model suited for linear discriminant analysis. More...
#include <LinearModel.h>
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 |
The LinearClassifier class is a multi class classifier model suited for linear discriminant analysis.
For c classes
the model holds class mean vectors
and a shared data scatter matrix
. It predicts the class of a vector x according to the rule
. The output is a unit vector in
composed of zeros and a single 1 entry in the component corresponding to the predicted class.
Definition at line 126 of file LinearModel.h.
| LinearClassifier::LinearClassifier | ( | int | dimension, | |
| int | classes | |||
| ) |
Definition at line 232 of file LinearModel.cpp.
References bNeedsUpdate, covariance, Model::inputDimension, inverse, mean, numberOfClasses, Model::outputDimension, and Model::parameter.
| LinearClassifier::~LinearClassifier | ( | ) |
Definition at line 251 of file LinearModel.cpp.
| 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.
| input | Vector of input values. | |
| output | Vector of output values. |
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().
bool LinearClassifier::bNeedsUpdate [protected] |
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().
int LinearClassifier::numberOfClasses [protected] |
Definition at line 141 of file LinearModel.h.
Referenced by getNumberOfClasses(), LinearClassifier(), model(), and setParameter().