svm能用字符型变量吗

Python040

svm能用字符型变量吗,第1张

字符变量是用来保存单字符的一种变量:如:char a='a' 而字符串就是用来保佑多个字符的变量,C语言中用字符数组来表式一个字符串 如:char name[]={"abcdefghikllllll"}。字符和字符串的区别在于是用双引号,还是单引号,双引号表字符串,单引号表字符,如:"a"和'a' 第一个是字符串,而第二个是字符。

c语言版本的也记录在 model 里面.其中model 是一个结构体,其定义如下.

struct svm_model

{

struct svm_parameter param // parameter

int nr_class // number of classes, = 2 in regression/one class svm

int l // total #SV

struct svm_node **SV // SVs (SV[l])

double **sv_coef // coefficients for SVs in decision functions (sv_coef[k-1][l])

double *rho // constants in decision functions (rho[k*(k-1)/2])

double *probA // pariwise probability information

double *probB

// for classification only

int *label // label of each class (label[k])

int *nSV // number of SVs for each class (nSV[k])

// nSV[0] + nSV[1] + ... + nSV[k-1] = l

// XXX

int free_sv // 1 if svm_model is created by svm_load_model

// 0 if svm_model is created by svm_train

}

里面的sv_coef就是指向 拉格朗日参数(可能乘了1或者-1)的指针的指针

=============

其实用Matlab版本的更方便