GURLS++  2.0.00
C++ Implementation of GURLS Matlab Toolbox
gurls::NormTestZScore< T > Class Template Reference

NormTestZScore is the sub-class of Norm that spheriphies the data according to the statistics cmoputed on the training set.

#include <normtestzscore.h>

Inheritance diagram for gurls::NormTestZScore< T >:
Collaboration diagram for gurls::NormTestZScore< T >:

List of all members.

Public Member Functions

GurlsOptionsListexecute (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)

Detailed Description

template<typename T>
class gurls::NormTestZScore< T >

Definition at line 59 of file normtestzscore.h.


Member Function Documentation

template<typename T >
GurlsOptionsList * gurls::NormTestZScore< T >::execute ( const gMat2D< T > &  X,
const gMat2D< T > &  Y,
const GurlsOptionsList opt 
) throw (gException) [virtual]
Parameters:
Xinput data matrix
Yinput data matrix
optoption list with the following field:
  • meanX
  • meanY
  • stdX
  • stdY
Returns:
spheriphied input data matrix

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;
}
template<typename T>
static Norm<T>* gurls::Norm< T >::factory ( const std::string &  id) throw (BadNormCreation) [inline, static, inherited]
Warning:
The returned pointer is a plain, un-managed pointer. The calling function is responsible of deallocating the object.

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);
    }

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends