参考 http://blog.csdn.net/lqhbupt/article/details/8599295
转到libsvm的python目录:
import os
os.chdir(‘C:\Program Files\libsvm-3.20\python’)
from svmutil import *
y, x = svm_read_problem(’../heart_scale‘)
m = svm_train(y[:200], x[:200], ‘-c 4’)
p_label, p_acc, p_val = svm_predict(y[200:], x[200:], m)
输出结果为:
Accuracy = 84.2857% (59/70) (classification)