python - SKLearn SVM : Different Membership Scores for Same Data -


i training svm 2 times, first, data loaded file , data directly assigned in code.

this code

from sklearn import svm import numpy np  x = np.genfromtxt("x.txt",delimiter=" ") y = np.genfromtxt("y.txt",delimiter=" ")  fromfile_clf = svm.linearsvc() fromfile_clf.fit(x, y) fromfile_dec = fromfile_clf.decision_function([[1,2,2]])  u = [[1,1, 0], [1,-1, -1], [-1,1,1], [-1,-1,1]] v = [0, 1, 2, 3]  direct_clf = svm.linearsvc() direct_clf.fit(u, v) direct_dec = direct_clf.decision_function([[1,2,2]])  print("loaded file") print("x") print x print("y") print y print("membership") print fromfile_dec    print("\n\ndata fed directly") print("u") print u print("v") print v print("membership") print direct_dec  

the output of above code is

loaded file x [[ 1.  1.  0.]  [ 1. -1. -1.]  [-1.  1.  1.]  [-1. -1.  1.]] y [ 0.  1.  2.  3.] membership [[  1.33332130e+00  -2.54545042e+00  -9.27855314e-06  -1.71427699e+00]]  data fed directly u [[1, 1, 0], [1, -1, -1], [-1, 1, 1], [-1, -1, 1]] v [0, 1, 2, 3] membership [[  1.33332173e+00  -2.54545295e+00  -1.57102577e-05  -1.71425921e+00]] 

the membership scores both methods seem different , there drastic change in score third class. wrong here?


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -