下载
- libsvm库下载:http://www.csie.ntu.edu.tw/~cjlin/libsvm/
- 数据集下载:http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/
配置
设置path:File->set path ->add with subfolders->加入libsvm-3.x文件夹的路径
使用
>> [label instance] = libsvmread('heart_scale');
>> svmStruct = svmtrain(label, instance);
*
optimization finished, #iter = 162
nu = 0.431029
obj = -100.877288, rho = 0.424462
nSV = 132, nBSV = 107
Total nSV = 132
>> [predict_label,accuracy] = svmpredict(label, instance, svmStruct);
Accuracy = 86.6667% (234/270) (classification)