![]() |
GURLS++
2.0.00
C++ Implementation of GURLS Matlab Toolbox
|
NormTestZScore is the sub-class of Norm that spheriphies the data according to the statistics cmoputed on the training set.
#include <normtestzscore.h>
Public Member Functions | |
GurlsOptionsList * | execute (const gMat2D< T > &X, const gMat2D< T > &Y, const GurlsOptionsList &opt) throw (gException) |
Spheriphies test data using the same mean and std deviation computed for the training set, previously computed and stored in opt by the NormZScore sub-class of the class Norm. | |
Static Public Member Functions | |
static Norm< T > * | factory (const std::string &id) throw (BadNormCreation) |
Factory function returning a pointer to the newly created object. | |
Protected Member Functions | |
void | centerRescale (gMat2D< T > &M, const T *stdDevs, const T *means) |
Definition at line 59 of file normtestzscore.h.
GurlsOptionsList * gurls::NormTestZScore< T >::execute | ( | const gMat2D< T > & | X, |
const gMat2D< T > & | Y, | ||
const GurlsOptionsList & | opt | ||
) | throw (gException) [virtual] |
X | input data matrix |
Y | input data matrix |
opt | option list with the following field:
|
Implements gurls::Norm< T >.
Definition at line 82 of file normtestzscore.h.
{ // [n,d] = size(X); const unsigned long n = X.rows(); const unsigned long d = X.cols(); const unsigned long m = Y.rows(); const unsigned long t = Y.cols(); GurlsOptionsList* norm = new GurlsOptionsList("norm"); if(n > 0ul && d > 0ul) { const gMat2D<T> &v_meanX = opt.getOptValue<OptMatrix<gMat2D<T> > >("meanX"); const gMat2D<T> &v_stdX = opt.getOptValue<OptMatrix<gMat2D<T> > >("stdX"); gMat2D<T>* retX = new gMat2D<T>(n, d); copy(retX->getData(), X.getData(), retX->getSize()); centerRescale(*retX, v_stdX.getData(), v_meanX.getData()); norm->addOpt("X", new OptMatrix<gMat2D<T> >(*retX)); } if(m > 0ul && t > 0ul) { const gMat2D<T> &v_meanY = opt.getOptValue<OptMatrix<gMat2D<T> > >("meanY"); const gMat2D<T> &v_stdY = opt.getOptValue<OptMatrix<gMat2D<T> > >("stdY"); gMat2D<T>* retY = new gMat2D<T>(m, t); copy(retY->getData(), Y.getData(), retY->getSize()); centerRescale(*retY, v_stdY.getData(), v_meanY.getData()); norm->addOpt("Y", new OptMatrix<gMat2D<T> >(*retY)); } return norm; }
static Norm<T>* gurls::Norm< T >::factory | ( | const std::string & | id | ) | throw (BadNormCreation) [inline, static, inherited] |
Definition at line 152 of file norm.h.
{ if(id == "l2") return new NormL2<T>; if(id == "zscore") return new NormZScore<T>; if(id == "testzscore") return new NormTestZScore<T>; throw BadNormCreation(id); }