latest version v1.9 - last update 10 Apr 2010 |
The linear regression algorithm estimates a linear relation between two vector spaces. More...
#include <ltiLinearRegression.h>
Classes | |
class | parameters |
the parameters for the class linearRegression More... | |
Public Member Functions | |
linearRegression () | |
linearRegression (const parameters &par) | |
linearRegression (const linearRegression &other) | |
virtual | ~linearRegression () |
virtual const char * | getTypeName () const |
matrix< T > | apply (matrix< T > &srcMatrix, matrix< T > &destMatrix) |
void | transform (vector< T > &srcVector, vector< T > &destVector) const |
vector< T > | transform (vector< T > &srcVector) const |
matrix< T > | getLinRegMatrix () const |
void | setLinRegMatrix (matrix< T > &linRegMatrixSet) |
linearRegression & | copy (const linearRegression &other) |
linearRegression & | operator= (const linearRegression &other) |
virtual functor * | clone () const |
const parameters & | getParameters () const |
virtual bool | read (ioHandler &handler, const bool complete=true) |
virtual bool | write (ioHandler &handler, const bool complete=true) const |
The linear regression algorithm estimates a linear relation between two vector spaces.
To each vector srcVect
of the source vector space with dimension srcDim
, the corresponding vector destDim
of the destination vector space with dimension destDim
can be calculated using the resulting regression matrix R:
destVect = R * srcVect.
R is calculated from a training set of corresponding vectors in both spaces. Note that srcVect
= 0 can only result in destVect
= 0, so it is important to eliminate any offsets from both vector spaces before using this algorithm:
destVect = destVectMean + R * (srcVect - srcVectMean)
For example application see ltiLinearRegressionTracking.
lti::linearRegression< T >::linearRegression | ( | ) |
default constructor
lti::linearRegression< T >::linearRegression | ( | const parameters & | par | ) |
default constructor with parameters
lti::linearRegression< T >::linearRegression | ( | const linearRegression< T > & | other | ) |
copy constructor
other | the object to be copied |
virtual lti::linearRegression< T >::~linearRegression | ( | ) | [virtual] |
destructor
matrix<T> lti::linearRegression< T >::apply | ( | matrix< T > & | srcMatrix, | |
matrix< T > & | destMatrix | |||
) |
The linear regression algorithm.
It calculates a linear transformation matrix linRegMatrix, that approximately fulfills destMatrix = linRegMatrix * srcMatrix.
srcMatrix | the columns of this matrix are the source training vectors of dimension srcDim | |
destMatrix | the columns of this matrix are the destination training vectors of dimension destDim |
virtual functor* lti::linearRegression< T >::clone | ( | ) | const [virtual] |
returns a pointer to a clone of this functor.
Implements lti::functor.
Reimplemented in lti::linearRegressionTracking.
linearRegression& lti::linearRegression< T >::copy | ( | const linearRegression< T > & | other | ) |
copy data of "other" functor.
other | the functor to be copied |
Reimplemented from lti::functor.
matrix<T> lti::linearRegression< T >::getLinRegMatrix | ( | ) | const |
gets the linear regression matrix
const parameters& lti::linearRegression< T >::getParameters | ( | ) | const |
returns used parameters
Reimplemented from lti::functor.
Reimplemented in lti::linearRegressionTracking.
virtual const char* lti::linearRegression< T >::getTypeName | ( | ) | const [virtual] |
returns the name of this type ("linearRegression")
Reimplemented from lti::linearAlgebraFunctor.
Reimplemented in lti::linearRegressionTracking.
linearRegression& lti::linearRegression< T >::operator= | ( | const linearRegression< T > & | other | ) |
Alias for copy.
Reimplemented from lti::functor.
virtual bool lti::linearRegression< T >::read | ( | ioHandler & | handler, | |
const bool | complete = true | |||
) | [virtual] |
Reads this functor from the given handler.
Reimplemented from lti::functor.
Reimplemented in lti::linearRegressionTracking.
void lti::linearRegression< T >::setLinRegMatrix | ( | matrix< T > & | linRegMatrixSet | ) |
sets the linear regression matrix
vector<T> lti::linearRegression< T >::transform | ( | vector< T > & | srcVector | ) | const |
void lti::linearRegression< T >::transform | ( | vector< T > & | srcVector, | |
vector< T > & | destVector | |||
) | const |
virtual bool lti::linearRegression< T >::write | ( | ioHandler & | handler, | |
const bool | complete = true | |||
) | const [virtual] |
Writes this functor to the given handler.
Reimplemented from lti::functor.
Reimplemented in lti::linearRegressionTracking.