![]() |
GURLS++
2.0.00
C++ Implementation of GURLS Matlab Toolbox
|
RLSAuto is the sub-class of Optimizer that implements automatic selection of primal/dual procedure.
#include <rlsauto.h>
Public Member Functions | |
GurlsOptionsList * | execute (const gMat2D< T > &X, const gMat2D< T > &Y, const GurlsOptionsList &opt) |
computes a RLS classifier, with automatic selection of primal/dual procedure. | |
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::RLSAuto< T >::execute | ( | const gMat2D< T > & | X, |
const gMat2D< T > & | Y, | ||
const GurlsOptionsList & | opt | ||
) | [virtual] |
The regularization parameter is set to the one found in the field paramsel of opt In case of multiclass problems, the regularizers need to be combined with the function specified inthe field singlelambda of opt
X | input data matrix |
Y | labels matrix |
opt | options with the following:
|
Implements gurls::Optimizer< T >.
Definition at line 82 of file rlsauto.h.
{ //[n,d] = size(X); const unsigned long n = X.rows(); const unsigned long d = X.cols(); // if (n > d) % Do primal if(n > d) { // cfr = rls_primal(X, y, opt); RLSPrimal<T> rlsprimal; return rlsprimal.execute(X, Y, opt); } // else % Do dual else { // cfr = rls_dual(X, y, opt); RLSDual<T> rlsdual; if(!opt.hasOpt("kernel.K")) { KernelLinear<T> kernelTask; GurlsOptionsList* kernel = kernelTask.execute(X, Y, opt); GurlsOptionsList tmp_opt("tmp"); GurlsOptionsList* tmp_paramsel = new GurlsOptionsList("paramsel"); tmp_paramsel->copyOpt("lambas", *(opt.getOptAs<GurlsOptionsList>("paramsel"))); tmp_opt.addOpt("paramsel", tmp_paramsel); tmp_opt.copyOpt("singlelambda", opt); tmp_opt.addOpt("kernel", kernel); return rlsdual.execute(X, Y, tmp_opt); } return rlsdual.execute(X, Y, opt); } }
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); }