libcmaes 0.10.2
A C++11 library for stochastic optimization with CMA-ES
Loading...
Searching...
No Matches
RankingSVM< TKernel > Class Template Reference

Ranking SVM algorithm with support for custom kernels. More...

#include <libcmaes/surrogates/rankingsvm.hpp>

Public Member Functions

void train (dMat &x, const int &niter, const dMat &covinv, const dVec &xmean)
 trains a ranker from a set of points
 
void predict (dVec &fit, dMat &x_test, dMat &x_train, const dMat &covinv, const dVec &xmean)
 predicts a ranking from a learnt ranker
 
void encode (dMat &x, const dMat &covinv, const dVec &xmean)
 encoding a set of point in a transformed space
 
void compute_training_kernel (dMat &x)
 pre-computation of the kernel values for every examples and coordinates
 
void optimize (const dMat &x, const int &niter)
 optimizes a ranker's model given a training set x
 
double error (dMat &x_test, dMat &x_train, const dVec &ref_fit, const dMat &covinv, const dVec &xmean)
 computes the ranker's error over a dataset
 

Public Attributes

bool _encode = false
 
dMat _K
 
dVec _alpha
 
dMat _dKij
 
dMat _C
 
double _Cval = 1e6
 
double _epsilon = 1.0
 
TKernel _kernel
 
std::mt19937 _rng
 
std::uniform_real_distribution _udist
 

Detailed Description

template<class TKernel = RBFKernel>
class RankingSVM< TKernel >

Ranking SVM algorithm with support for custom kernels.

Member Function Documentation

◆ compute_training_kernel()

template<class TKernel = RBFKernel>
void RankingSVM< TKernel >::compute_training_kernel ( dMat &  x)
inline

pre-computation of the kernel values for every examples and coordinates

Parameters
xtraining set as a point per column of the matrix

◆ encode()

template<class TKernel = RBFKernel>
void RankingSVM< TKernel >::encode ( dMat &  x,
const dMat &  covinv,
const dVec &  xmean 
)
inline

encoding a set of point in a transformed space

Parameters
xthe points to be transformed, one per column of the matrix
covinvthe inverse sqrt covariance of the points in the training set
trainingset mean distribution if available along with covariance matrix

◆ error()

template<class TKernel = RBFKernel>
double RankingSVM< TKernel >::error ( dMat &  x_test,
dMat &  x_train,
const dVec &  ref_fit,
const dMat &  covinv,
const dVec &  xmean 
)
inline

computes the ranker's error over a dataset

Parameters
x_testtesting dataset, with one point per column of the matrix
x_trainthe initial training dataset, used by encode() if needed
ref_fitthe reference ranking fit against which to test the prediction
covinvthe inverse sqrt covariance of the points in the training set, if available and needed, encode() function.
trainingset mean distribution if available along with covariance matrix, and needed, see encode() function
See also
encode

◆ optimize()

template<class TKernel = RBFKernel>
void RankingSVM< TKernel >::optimize ( const dMat &  x,
const int &  niter 
)
inline

optimizes a ranker's model given a training set x

Parameters
trainingset as a set of points in column of the matrix
niterthe number of iterations allowed for optimization

◆ predict()

template<class TKernel = RBFKernel>
void RankingSVM< TKernel >::predict ( dVec &  fit,
dMat &  x_test,
dMat &  x_train,
const dMat &  covinv,
const dVec &  xmean 
)
inline

predicts a ranking from a learnt ranker

Parameters
fitthe final ranking fitted by the ranker
x_testpoints to be ranked, one per column of the matrix
x_trainthe initial training set, possibly used by kernel computation
covinvthe inverse sqrt covariance of the points in the training set, if available and needed, encode() function.
trainingset mean distribution if available along with covariance matrix, and needed, see encode() function
See also
encode

◆ train()

template<class TKernel = RBFKernel>
void RankingSVM< TKernel >::train ( dMat &  x,
const int &  niter,
const dMat &  covinv,
const dVec &  xmean 
)
inline

trains a ranker from a set of points

Parameters
xmatrix in which every column represents a point from the training set
covinvthe inverse sqrt covariance of the points in the training set, if available and needed, encode() function.
trainingset mean distribution if available along with covariance matrix, and needed, see encode() function
See also
encode

Member Data Documentation

◆ _alpha

template<class TKernel = RBFKernel>
dVec RankingSVM< TKernel >::_alpha

vector of Ranking SVM parameters over ranking constraints.

◆ _C

template<class TKernel = RBFKernel>
dMat RankingSVM< TKernel >::_C

constraint violation weights.

◆ _Cval

template<class TKernel = RBFKernel>
double RankingSVM< TKernel >::_Cval = 1e6

constraing violation base weight value.

◆ _encode

template<class TKernel = RBFKernel>
bool RankingSVM< TKernel >::_encode = false

whether to use encoding from inverse sqrt covariance matrix of points.

◆ _K

template<class TKernel = RBFKernel>
dMat RankingSVM< TKernel >::_K

pre-computed matrix of kernel values for a given training set.

◆ _kernel

template<class TKernel = RBFKernel>
TKernel RankingSVM< TKernel >::_kernel

kernel class.


The documentation for this class was generated from the following file: