㈠ Matlab的libsvm 中訓練參數怎麼輸出
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版本的更方便