[scikit-learn] svm low-api gives bad prediction results
fulean
fla168 at 163.com
Tue Dec 13 12:48:37 EST 2016
hi all,
I want to export the svm parameters and apply it in a c++ svm implementation at https://github.com/yctung/AndroidLibSvm. after grid search, SVC with C=1.0,gamma =10.0 get 92% accuracy, but unfortunately, SVC model does't contains the paratmeters needed by the c++ model, which take as input the low-level svm params, ie sv_coef,probA ..., the returns of low level svm api ,'libsvm.fit', match the requirement, but the prediction result is different from SVC model:
The code :
model = libsvm.fit(X_data.astype(np.float64),Y_data.astype(np.float64),svm_type=0,kernel='rbf',C = 1.0,gamm= 10.0)
pred = libsvm.predict(X_data.astype(np.float64), *model,kernel='rbf')
print "hello mean " + sa tr(np.mean(pred == Y_data)) # result "hello mean 0.570588235294"
can somebody give some suggestion on this problem,thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-learn/attachments/20161214/fca61597/attachment.html>
More information about the scikit-learn
mailing list