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

PredRandFeats is the sub-class of Prediction that computes the predictions of the linear classifier stored in opt.rls.W, and obtained the Random Features approach proposed in: Ali Rahimi, Ben Recht; Random Features for Large-Scale Kernel Machines; in Neural Information Processing Systems (NIPS) 2007. More...

#include <predrandfeats.h>

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

List of all members.

Public Member Functions

GurlsOptionsListexecute (const gMat2D< T > &X, const gMat2D< T > &Y, const GurlsOptionsList &opt)
 computes the predictions of the linear classifier stored in opt.rls.W

Static Public Member Functions

static Prediction< T > * factory (const std::string &id) throw (BadPredictionCreation)
 Factory function returning a pointer to the newly created object.

Detailed Description

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

on the samples passed in the X matrix.

Definition at line 67 of file predrandfeats.h.


Member Function Documentation

template<typename T >
GurlsOptionsList * gurls::PredRandFeats< T >::execute ( const gMat2D< T > &  X,
const gMat2D< T > &  Y,
const GurlsOptionsList opt 
) [virtual]
Parameters:
Xinput data matrix
Ylabels matrix
optstructure of options with the following fields (and subfields):
  • optimizer.W (set by the optimizer tasks)
  • optimizer.proj (set by the optimizer tasks)
Returns:
matrix of predicted labels

Implements gurls::Prediction< T >.

Definition at line 84 of file predrandfeats.h.

{

//    G = rp_apply_real(X, opt.rls.proj);
    const gMat2D<T>& proj = opt.getOptValue<OptMatrix<gMat2D<T> > >("optimizer.proj");
    gMat2D<T> *G = rp_apply_real(X, proj);

//    scores = G*opt.rls.W;
    const gMat2D<T>& W = opt.getOptValue<OptMatrix<gMat2D<T> > >("optimizer.W");

    gMat2D<T> *scores_mat = new gMat2D<T>(G->rows(), W.cols());
    dot(G->getData(), W.getData(), scores_mat->getData(), G->rows(), G->cols(), W.rows(), W.cols(), G->rows(), W.cols(), CblasNoTrans, CblasNoTrans, CblasColMajor);


    GurlsOptionsList* pred = new GurlsOptionsList("pred");
    pred->addOpt("scores", new OptMatrix<gMat2D<T> >(*scores_mat));

    return pred;
}
template<typename T>
static Prediction<T>* gurls::Prediction< T >::factory ( const std::string &  id) throw (BadPredictionCreation) [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 112 of file pred.h.

    {
        if(id == "primal")
            return new PredPrimal<T>;
        if(id == "dual")
            return new PredDual<T>;
        if(id == "gpregr")
            return new PredGPRegr<T>;
        if(id == "randfeats")
            return new PredRandFeats<T>;

        throw BadPredictionCreation(id);
    }

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