cjlin1 / libsvm

LIBSVM -- A Library for Support Vector Machines
https://www.csie.ntu.edu.tw/~cjlin/libsvm/
BSD 3-Clause "New" or "Revised" License
4.54k stars 1.64k forks source link

use python/libsvm twice get different value #142

Open cristianoandy opened 5 years ago

cristianoandy commented 5 years ago

train_label = trainlabel[:] train_data = traindata[:] cmd = '-v 3 -c 0.5 -g 0.5 -h 0' cmd1 = '-v 3 -c 0.5 -g 0.5 -h 0' model = svm_train(trainlabel,traindata,cmd) model1 = svm_train(train_label, train_data, cmd1) When I run this code, the model is not equal to model1.

cjlin1 commented 5 years ago

For cross validation (-v) data are randomly split so you got different results. On 2019-04-23 06:53, cristianoandy wrote:

train_label = trainlabel[:] train_data = traindata[:] cmd = '-v 3 -c 0.5 -g 0.5 -h 0' cmd1 = '-v 3 -c 0.5 -g 0.5 -h 0' model = svm_train(trainlabel,traindata,cmd) model1 = svm_train(train_label, train_data, cmd1) When I run this code, the model is not equal to model1.

-- You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub [1], or mute the thread [2]. [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/cjlin1/libsvm/issues/142", "url": "https://github.com/cjlin1/libsvm/issues/142", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

Links:

[1] https://github.com/cjlin1/libsvm/issues/142 [2] https://github.com/notifications/unsubscribe-auth/ABI3BHWYNCSHBPHQLFU5MFLPR4IELANCNFSM4HHYFVWA