CSVM类参考


详细描述

A generic Support Vector Machine Interface.

A support vector machine is defined as

\[ f({\bf x})=\sum_{i=0}^{N-1} \alpha_i k({\bf x}, {\bf x_i})+b \]

where $N$ is the number of training examples $\alpha_i$ are the weights assigned to each training example $k(x,x')$ is the kernel and $b$ the bias.

Using an a-priori choosen kernel, the $\alpha_i$ and bias are determined by solving the following quadratic program

\begin{eqnarray*} \max_{\bf \alpha} && \sum_{i=0}^{N-1} \alpha_i - \sum_{i=0}^{N-1}\sum_{j=0}^{N-1} \alpha_i y_i \alpha_j y_j k({\bf x_i}, {\bf x_j})\\ \mbox{s.t.} && 0\leq\alpha_i\leq C\\ && \sum_{i=0}^{N-1} \alpha_i y_i=0\\ \end{eqnarray*}

here C is a pre-specified regularization parameter.

在文件SVM.h46行定义。

继承图,类CSVM
Inheritance graph
[图例]

所有成员的列表。

公有成员

 CSVM (int32_t num_sv=0)
 CSVM (float64_t C, CKernel *k, CLabels *lab)
virtual ~CSVM ()
void set_defaults (int32_t num_sv=0)
virtual std::vector< float64_tget_linear_term ()
virtual void set_linear_term (std::vector< float64_t > lin)
bool load (FILE *svm_file)
bool save (FILE *svm_file)
void set_nu (float64_t nue)
void set_C (float64_t c1, float64_t c2)
void set_epsilon (float64_t eps)
void set_tube_epsilon (float64_t eps)
void set_qpsize (int32_t qps)
float64_t get_epsilon ()
float64_t get_nu ()
float64_t get_C1 ()
float64_t get_C2 ()
int32_t get_qpsize ()
void set_shrinking_enabled (bool enable)
bool get_shrinking_enabled ()
float64_t compute_svm_dual_objective ()
float64_t compute_svm_primal_objective ()
void set_objective (float64_t v)
float64_t get_objective ()
void set_callback_function (CMKL *m, bool(*cb)(CMKL *mkl, const float64_t *sumw, const float64_t suma))
virtual const char * get_name () const

保护成员

virtual float64_tget_linear_term_array ()

保护属性

std::vector< float64_tlinear_term
bool svm_loaded
float64_t epsilon
float64_t tube_epsilon
float64_t nu
float64_t C1
float64_t C2
float64_t objective
int32_t qpsize
bool use_shrinking
bool(* callback )(CMKL *mkl, const float64_t *sumw, const float64_t suma)
CMKLmkl

构造及析构函数文档

CSVM ( int32_t  num_sv = 0  ) 

Create an empty Support Vector Machine Object

参数:
num_sv with num_sv support vectors

在文件SVM.cpp31行定义。

CSVM ( float64_t  C,
CKernel k,
CLabels lab 
)

Create a Support Vector Machine Object from a trained SVM

参数:
C the C parameter
k the Kernel object
lab the Label object

在文件SVM.cpp37行定义。

~CSVM (  )  [virtual]

在文件SVM.cpp46行定义。


成员函数文档

float64_t compute_svm_dual_objective (  ) 

compute svm dual objective

返回:
computed dual objective

在文件SVM.cpp223行定义。

float64_t compute_svm_primal_objective (  ) 

compute svm primal objective

返回:
computed svm primal objective

在文件SVM.cpp248行定义。

float64_t get_C1 (  ) 

get C1

返回:
C1

在文件SVM.h145行定义。

float64_t get_C2 (  ) 

get C2

返回:
C2

在文件SVM.h151行定义。

float64_t get_epsilon (  ) 

get epsilon

返回:
epsilon

在文件SVM.h133行定义。

std::vector< float64_t > get_linear_term (  )  [virtual]

get linear term

返回:
lin the linear term

在文件SVM.cpp305行定义。

float64_t * get_linear_term_array (  )  [protected, virtual]

get linear term copy as dynamic array

返回:
linear term copied to a dynamic array

在文件SVM.cpp275行定义。

virtual const char* get_name (  )  const [virtual]
返回:
object name

实现了CSGObject

CMKLCGMNPSVMCGNPPSVMCGPBTSVMCLaRankCLibSVMCLibSVMMultiClassCLibSVMOneClassCMPDSVMCScatterSVMCLibSVR重载。

在文件SVM.h218行定义。

float64_t get_nu (  ) 

get nu

返回:
nu

在文件SVM.h139行定义。

float64_t get_objective (  ) 

get objective

返回:
objective

在文件SVM.h202行定义。

int32_t get_qpsize (  ) 

get qpsize

返回:
qpsize

在文件SVM.h157行定义。

bool get_shrinking_enabled (  ) 

get state of shrinking

返回:
if shrinking is enabled

在文件SVM.h172行定义。

bool load ( FILE *  svm_file  )  [virtual]

load a SVM from file

参数:
svm_file the file handle

重载CClassifier

CMultiClassSVM重载。

在文件SVM.cpp77行定义。

bool save ( FILE *  svm_file  )  [virtual]

write a SVM to a file

参数:
svm_file the file handle

重载CClassifier

CMultiClassSVM重载。

在文件SVM.cpp190行定义。

void set_C ( float64_t  c1,
float64_t  c2 
)

set C

参数:
c1 new C constant for negatively labelled examples
c2 new C constant for positively labelled examples

Note that not all SVMs support this (however at least CLibSVM and CSVMLight do)

在文件SVM.h109行定义。

void set_callback_function ( CMKL m,
bool(*)(CMKL *mkl, const float64_t *sumw, const float64_t suma)  cb 
)

set callback function svm optimizers may call when they have a new (small) set of alphas

参数:
m pointer to mkl object
cb callback function

在文件SVM.cpp213行定义。

void set_defaults ( int32_t  num_sv = 0  ) 

set default values for members a SVM object

在文件SVM.cpp51行定义。

void set_epsilon ( float64_t  eps  ) 

set epsilon

参数:
eps new epsilon

在文件SVM.h115行定义。

void set_linear_term ( std::vector< float64_t lin  )  [virtual]

set linear term of the QP

参数:
lin the linear term

在文件SVM.cpp286行定义。

void set_nu ( float64_t  nue  ) 

set nu

参数:
nue new nu

在文件SVM.h99行定义。

void set_objective ( float64_t  v  ) 

set objective

参数:
v objective

在文件SVM.h193行定义。

void set_qpsize ( int32_t  qps  ) 

set qpsize

参数:
qps new qpsize

在文件SVM.h127行定义。

void set_shrinking_enabled ( bool  enable  ) 

set state of shrinking

参数:
enable if shrinking will be enabled

在文件SVM.h163行定义。

void set_tube_epsilon ( float64_t  eps  ) 

set tube epsilon

参数:
eps new tube epsilon

在文件SVM.h121行定义。


成员数据文档

float64_t C1 [protected]

C1 regularization const

在文件SVM.h299行定义。

float64_t C2 [protected]

C2

在文件SVM.h301行定义。

bool(* callback)(CMKL *mkl, const float64_t *sumw, const float64_t suma) [protected]

callback function svm optimizers may call when they have a new (small) set of alphas

float64_t epsilon [protected]

epsilon

在文件SVM.h293行定义。

std::vector<float64_t> linear_term [protected]

linear term in qp

在文件SVM.h288行定义。

CMKL* mkl [protected]

mkl object that svm optimizers need to pass when calling the callback function

在文件SVM.h314行定义。

float64_t nu [protected]

nu

在文件SVM.h297行定义。

float64_t objective [protected]

objective

在文件SVM.h303行定义。

int32_t qpsize [protected]

qpsize

在文件SVM.h305行定义。

bool svm_loaded [protected]

if SVM is loaded

在文件SVM.h291行定义。

float64_t tube_epsilon [protected]

tube epsilon for support vector regression

在文件SVM.h295行定义。

bool use_shrinking [protected]

if shrinking shall be used

在文件SVM.h307行定义。


该类的文档由以下文件生成:

SHOGUN Machine Learning Toolbox - Documentation