![]() |
GURLS++
2.0.00
C++ Implementation of GURLS Matlab Toolbox
|
RLSGPRegr is the sub-class of Optimizer that implements GP inference.
#include <rlsgp.h>
Public Member Functions | |
GurlsOptionsList * | execute (const gMat2D< T > &X, const gMat2D< T > &Y, const GurlsOptionsList &opt) |
Performs GP inference. | |
Static Public Member Functions | |
static Optimizer< T > * | factory (const std::string &id) throw (BadOptimizerCreation) |
Factory function returning a pointer to the newly created object. |
GurlsOptionsList * gurls::RLSGPRegr< T >::execute | ( | const gMat2D< T > & | X, |
const gMat2D< T > & | Y, | ||
const GurlsOptionsList & | opt | ||
) | [virtual] |
The noiselevel is set to the one found in the field paramsel of opt. In case of multiclass problems, the noiselevel needs to be combined with the function specified in the field singlelambda of opt
X | input data matrix |
Y | labels matrix |
opt | options with the following:
|
Implements gurls::Optimizer< T >.
Definition at line 88 of file rlsgp.h.
{ // noise = opt.singlelambda(opt.paramsel.lambdas); const gMat2D<T> &ll = opt.getOptValue<OptMatrix<gMat2D<T> > >("paramsel.lambdas"); T noiselevel = opt.getOptAs<OptFunction>("singlelambda")->getValue(ll.getData(), ll.getSize()); const gMat2D<T> &K_mat = opt.getOptValue<OptMatrix<gMat2D<T> > >("kernel.K"); T* K = new T[K_mat.getSize()]; copy(K, K_mat.getData(), K_mat.getSize()); //n = size(opt.kernel.K,1); const unsigned long n = K_mat.rows(); //T = size(y,2); const unsigned long t = Y.cols(); // cfr.L = chol(opt.kernel.K + noise^2*eye(n)); const T coeff = std::pow(noiselevel, 2); unsigned long i=0; for(T* it = K; i<n; ++i, it += n+1) *it += coeff; T* retL = new T[n*n]; cholesky(K, n, n, retL); // cfr.alpha = cfr.L\(cfr.L'\y); gMat2D<T>* alpha = new gMat2D<T>(n, t); copy(alpha->getData(), Y.getData(), Y.getSize()); mldivide_squared(retL, alpha->getData(), n, n, n, t, CblasTrans); mldivide_squared(retL, alpha->getData(), n, n, n, t, CblasNoTrans); GurlsOptionsList* optimizer = new GurlsOptionsList("optimizer"); // optimizer.L = L; gMat2D<T>* L = new gMat2D<T>(n, n); copy(L->getData(), retL, L->getSize()); optimizer->addOpt("L", new OptMatrix<gMat2D<T> >(*L)); delete[] retL; // optimizer.alpha = alpha; optimizer->addOpt("alpha", new OptMatrix<gMat2D<T> >(*alpha)); // cfr.X = X; gMat2D<T>* optX = new gMat2D<T>(X); optimizer->addOpt("X", new OptMatrix<gMat2D<T> >(*optX)); return optimizer; }
static Optimizer<T>* gurls::Optimizer< T >::factory | ( | const std::string & | id | ) | throw (BadOptimizerCreation) [inline, static, inherited] |
Definition at line 130 of file optimization.h.
{ if(id == "rlsauto") return new RLSAuto<T>; if(id == "rlsprimal") return new RLSPrimal<T>; if(id == "rlsprimalr") return new RLSPrimalr<T>; if(id == "rlsdual") return new RLSDual<T>; if(id == "rlsdualr") return new RLSDualr<T>; if(id == "rlspegasos") return new RLSPegasos<T>; if(id == "rlsgpregr") return new RLSGPRegr<T>; if(id == "rlsprimalrecinit") return new RLSPrimalRecInit<T>; if(id == "rlsprimalrecupdate") return new RLSPrimalRecUpdate<T>; if(id == "rlsrandfeats") return new RLSRandFeats<T>; throw BadOptimizerCreation(id); }