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

RLSAuto is the sub-class of Optimizer that implements automatic selection of primal/dual procedure.

#include <rlsauto.h>

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

List of all members.

Public Member Functions

GurlsOptionsListexecute (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.

Detailed Description

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

Definition at line 58 of file rlsauto.h.


Member Function Documentation

template<typename T >
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

Parameters:
Xinput data matrix
Ylabels matrix
optoptions with the following:
  • singlelambda (default)
  • paramsel (settable with the class ParamSelection and its subclasses)
  • kernel (list with the filed type set to 'linear', settable with the class Kernel and its KernelLinear)
Returns:
adds to opt the field optimizer, which is a list containing the following fields:
  • W = matrix of coefficient vectors of rls estimator for each class
  • C = empty matrix
  • X = empty matrix

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);
    }
}
template<typename T>
static Optimizer<T>* gurls::Optimizer< T >::factory ( const std::string &  id) throw (BadOptimizerCreation) [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 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);
    }

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