libsvm icon indicating copy to clipboard operation
libsvm copied to clipboard

Wrong information in Octave when training C-SVC and NU-SVC

Open ghost opened this issue 7 years ago • 1 comments

When I train a nu-SVC in Octave with the command

model = svmtrain(ytrain, Xtrain_norm, '-s 1 -t 2');

I get this output

* optimization finished, #iter = 570 C = 0.085946 obj = 17.382239, rho = -0.596579 nSV = 859, nBSV = 808 Total nSV = 859

At the beginning I was puzzled by that "C = 0.085946", which had led me into thinking that a C-SVM was trained instead, and that there was an error in the libraries...

Also because if I use the "-s 0" argument (which means C-SVC) it outputs:

model = svmtrain(ytrain, Xtrain_norm, '-s 0 -t 2'); * optimization finished, #iter = 595 nu = 0.227101 obj = -279.128990, rho = -0.810343 nSV = 430, nBSV = 328 Total nSV = 430

So I was thinking that the two arguments were swapped.

I went a little bit further and I tried running the svm-train binary with the same arguments:

svm-train -s 1 -t 2 trainingset_libsvm.dat model_libsvm_NU.dat

Excact same output as above but inside the created file I found:

svm_type nu_svc kernel_type rbf gamma 0.0833333 nr_class 2 total_sv 859 rho -0.596582 label 0 1 nr_sv 428 431 SV`

So is it just the information printed that is wrong? Or is it correct and I'm not understanding something?

Thanks

ghost avatar Feb 23 '17 10:02 ghost

C-svc and nu-svc are equivalent. So when you train nu-svc we print out the corresponding C marcwell writes:

When I train a nu-SVC in Octave with the command

model = svmtrain(ytrain, Xtrain_norm, '-s 1 -t 2');

I get this output

optimization finished, #iter = 570 C = 0.085946 obj = 17.382239, rho = -0.596579 nSV = 859, nBSV = 808 Total nSV = 859

At the beginning I was puzzled by that "C = 0.085946", which had led me into thinking that a C-SVM was trained instead, and that there was an error in the libraries...

Also because if I use the "-s 0" argument (which means C-SVC) it outputs:

model = svmtrain(ytrain, Xtrain_norm, '-s 0 -t 2'); * optimization finished, #iter = 595 nu = 0.227101 obj = -279.128990, rho = -0.810343 nSV = 430, nBSV = 328 Total nSV = 430

So I was thinking that the two arguments were swapped.

I went a little bit further and I tried running the svm-train binary with the same arguments:

svm-train -s 1 -t 2 trainingset_libsvm.dat model_libsvm_NU.dat

Excact same output as above but inside the created file I found:

svm_type nu_svc kernel_type rbf gamma 0.0833333nr_class 2total_sv 859rho -0.596582label 0 1nr_sv 428 431SV`

So is it just the information printed that is wrong? Or is it correct and I'm not understanding something?

Thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.*

cjlin1 avatar Feb 24 '17 01:02 cjlin1