![]() |
GURLS++
2.0.00
C++ Implementation of GURLS Matlab Toolbox
|
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>


Public Member Functions | |
| GurlsOptionsList * | execute (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. | |
on the samples passed in the X matrix.
Definition at line 67 of file predrandfeats.h.
| GurlsOptionsList * gurls::PredRandFeats< T >::execute | ( | const gMat2D< T > & | X, |
| const gMat2D< T > & | Y, | ||
| const GurlsOptionsList & | opt | ||
| ) | [virtual] |
| X | input data matrix |
| Y | labels matrix |
| opt | structure of options with the following fields (and subfields):
|
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;
}
| static Prediction<T>* gurls::Prediction< T >::factory | ( | const std::string & | id | ) | throw (BadPredictionCreation) [inline, static, inherited] |
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);
}