Linear Discriminant Analysis (LDA) More...
#include <shark/Algorithms/Trainers/LDA.h>
Inheritance diagram for shark::LDA:Public Member Functions | |
| LDA (double regularization=0.0) | |
| constructor | |
| std::string | name () const |
| From INameable: return the class name. | |
| double | regularization () const |
| return the regularization constant | |
| void | setRegularization (double regularization) |
| set the regularization constant. 0 means no regularization. | |
| RealVector | parameterVector () const |
| inherited from IParameterizable; read the regularization parameter | |
| void | setParameterVector (RealVector const ¶m) |
| inherited from IParameterizable; set the regularization parameter | |
| size_t | numberOfParameters () const |
| inherited from IParameterizable | |
| SHARK_EXPORT_SYMBOL void | train (LinearClassifier<> &model, LabeledData< RealVector, unsigned int > const &dataset) |
| Compute the LDA solution for a multi-class problem. | |
| SHARK_EXPORT_SYMBOL void | train (LinearClassifier<> &model, WeightedLabeledData< RealVector, unsigned int > const &dataset) |
| Compute the LDA solution for a weighted multi-class problem. | |
Public Member Functions inherited from shark::AbstractWeightedTrainer< LinearClassifier<>, unsigned int > | |
| virtual void | train (ModelType &model, WeightedDatasetType const &dataset)=0 |
| Executes the algorithm and trains a model on the given weighted data. | |
| virtual void | train (ModelType &model, DatasetType const &dataset) |
| Executes the algorithm and trains a model on the given unweighted data. | |
Public Member Functions inherited from shark::AbstractTrainer< Model, LabelTypeT > | |
| virtual void | train (ModelType &model, DatasetType const &dataset)=0 |
| Core of the Trainer interface. | |
Public Member Functions inherited from shark::INameable | |
| virtual | ~INameable () |
Public Member Functions inherited from shark::ISerializable | |
| virtual | ~ISerializable () |
| Virtual d'tor. | |
| virtual void | read (InArchive &archive) |
| Read the component from the supplied archive. | |
| virtual void | write (OutArchive &archive) const |
| Write the component to the supplied archive. | |
| void | load (InArchive &archive, unsigned int version) |
| Versioned loading of components, calls read(...). | |
| void | save (OutArchive &archive, unsigned int version) const |
| Versioned storing of components, calls write(...). | |
| BOOST_SERIALIZATION_SPLIT_MEMBER () | |
Public Member Functions inherited from shark::IParameterizable< VectorType > | |
| virtual | ~IParameterizable () |
Protected Attributes | |
| double | m_regularization |
Additional Inherited Members | |
Public Types inherited from shark::AbstractWeightedTrainer< LinearClassifier<>, unsigned int > | |
| typedef base_type::ModelType | ModelType |
| typedef base_type::InputType | InputType |
| typedef base_type::LabelType | LabelType |
| typedef base_type::DatasetType | DatasetType |
| typedef WeightedLabeledData< InputType, LabelType > | WeightedDatasetType |
Public Types inherited from shark::AbstractTrainer< Model, LabelTypeT > | |
| typedef Model | ModelType |
| typedef ModelType::InputType | InputType |
| typedef LabelTypeT | LabelType |
| typedef LabeledData< InputType, LabelType > | DatasetType |
Public Types inherited from shark::IParameterizable< VectorType > | |
| typedef VectorType | ParameterVectorType |
Linear Discriminant Analysis (LDA)
This classes implements the well known linear discriminant analysis. LDA assumes that every point is drawn from a multivariate normal distributions. Every class has its own mean but all classes have the same covariance.
An arbitrary number of classes is supported. The resulting model is of the form
\[ \arg \max_c \log(p(x|c)*P(c)) \]
where \( p(x|c) = \exp(-(x-m_c)^T(C+\alpha I)(x-m_c)) \). \( m_c\) are the means of class c, \( C \) is the covariance matrix formed by all data points. The regularization paramter \( \alpha \) is by default 0. The trainer is implemented such, that it still works when C is singular, in this case the singular directions are ignored.
|
inline |
constructor
Definition at line 63 of file LDA.h.
References regularization(), and setRegularization().
|
inlinevirtual |
From INameable: return the class name.
Reimplemented from shark::INameable.
|
inlinevirtual |
inherited from IParameterizable
Reimplemented from shark::IParameterizable< VectorType >.
|
inlinevirtual |
inherited from IParameterizable; read the regularization parameter
Reimplemented from shark::IParameterizable< VectorType >.
Definition at line 83 of file LDA.h.
References m_regularization.
|
inline |
return the regularization constant
Definition at line 72 of file LDA.h.
References m_regularization.
Referenced by LDA(), and setRegularization().
|
inlinevirtual |
inherited from IParameterizable; set the regularization parameter
Reimplemented from shark::IParameterizable< VectorType >.
Definition at line 89 of file LDA.h.
References m_regularization, and SIZE_CHECK.
|
inline |
set the regularization constant. 0 means no regularization.
Definition at line 77 of file LDA.h.
References m_regularization, RANGE_CHECK, and regularization().
Referenced by LDA().
| SHARK_EXPORT_SYMBOL void shark::LDA::train | ( | LinearClassifier<> & | model, |
| LabeledData< RealVector, unsigned int > const & | dataset | ||
| ) |
| SHARK_EXPORT_SYMBOL void shark::LDA::train | ( | LinearClassifier<> & | model, |
| WeightedLabeledData< RealVector, unsigned int > const & | dataset | ||
| ) |
Compute the LDA solution for a weighted multi-class problem.
|
protected |
The regularization parameter \( \lambda \) adds \( - \lambda I \) to the second moment matrix, where \( I \) is the identity matrix
Definition at line 107 of file LDA.h.
Referenced by parameterVector(), regularization(), setParameterVector(), and setRegularization().