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

RLSGPRegr is the sub-class of Optimizer that implements GP inference.

#include <rlsgp.h>

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

List of all members.

Public Member Functions

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

Detailed Description

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

Definition at line 63 of file rlsgp.h.


Member Function Documentation

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

Parameters:
Xinput data matrix
Ylabels matrix
optoptions with the following:
  • singlelambda (default)
  • paramsel (settable with the class ParamSelection and its subclasses, and containing field noiselevels)
  • kernel (settable with the class Kernel and its subclasses)
Returns:
adds to opt the field optimizer, which is a list containing the following fields:
  • L
  • alpha
  • X

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;
}
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