![]() |
GURLS++
2.0.00
C++ Implementation of GURLS Matlab Toolbox
|
PredPrimal is the sub-class of Prediction that computes the predictions of a linear classifier in the primal formulation.
#include <primal.h>


Public Member Functions | |
| OptMatrix< gMat2D< T > > * | execute (const gMat2D< T > &X, const gMat2D< T > &Y, const GurlsOptionsList &opt) |
| Computes the predictions of the linear classifier stored in the field optimizer of opt and computed using the primal formulation on the samples passed in the X matrix. | |
Static Public Member Functions | |
| static Prediction< T > * | factory (const std::string &id) throw (BadPredictionCreation) |
| Factory function returning a pointer to the newly created object. | |
| OptMatrix< gMat2D< T > > * gurls::PredPrimal< T >::execute | ( | const gMat2D< T > & | X, |
| const gMat2D< T > & | Y, | ||
| const GurlsOptionsList & | opt | ||
| ) | [virtual] |
| X | input data matrix |
| Y | labels matrix |
| opt | options with the following:
|
Implements gurls::Prediction< T >.
Definition at line 84 of file primal.h.
{
if (opt.hasOpt("optimizer"))
{
const gMat2D<T>& W = opt.getOptValue<OptMatrix<gMat2D<T> > >("optimizer.W");
gMat2D<T>* Z = new gMat2D<T>(X.rows(), W.cols());
dot(X.getData(), W.getData(), Z->getData(), X.rows(), X.cols(), W.rows(), W.cols(), Z->rows(), Z->cols(), CblasNoTrans, CblasNoTrans, CblasColMajor);
return new OptMatrix<gMat2D<T> >(*Z);
}
else
throw gException(gurls::Exception_Required_Parameter_Missing);
}
| 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);
}