Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One-Class SVM yielding different results with OpenMP in Matlab #151

Open
seijikun opened this issue Sep 19, 2019 · 6 comments
Open

One-Class SVM yielding different results with OpenMP in Matlab #151

seijikun opened this issue Sep 19, 2019 · 6 comments

Comments

@seijikun
Copy link

I see very weird behavior when applying OpenMP as stated in the FAQ, in combination with one-class-SVMs.

When I train a one-class SVM with OpenMP in Matlab, I get a different accuracy (way better) than when I train the one-class SVM without OpenMP. However, when using Octave, I get the same results in both cases.

Accuracy-Results(Matlab):

normalAccuracy = 0.5;
parallelAccuracy = 1;

Accuracy-Results(Octave):

normalAccuracy = 0.5;
parallelAccuracy = 0.5;

I added a complete example-project for reproduction:
libsvmtest.tar.gz
The FAQ only mentions SVC_Q::get_Q and SVR_Q::get_Q to apply the OpenMP pragmas, so I did not apply it on ONE_CLASS_Q::get_Q for this experiment.
OpenMP is therefore only used for the prediction.

@ZYQue
Copy link
Contributor

ZYQue commented Sep 21, 2019

Hello,

I try to reproduce by your files but I get parallelAccuracy=0.5 in Matlab. Could you please provide the decision values in both normal and parallel cases?

@seijikun
Copy link
Author

Sure! Here are the stored svmModels:
svmModels.tar.gz

Some system-information:
Operating-System: Linux openSUSE Tumbleweed
Octave: 5.1.0
Matlab: R2019a Update 5 (9.6.0.1174912) 64-bit (glnxa64)
libsvm: 3.24
gcc: 9.2.1 20190820 [gcc-9-branch revision 274748]

@ZYQue
Copy link
Contributor

ZYQue commented Sep 21, 2019

Sorry, maybe I didn't make myself clear. For decision values, I mean:

[predicted_label, accuracy, decision_values/prob_estimates] = svmpredict(testing_label_vector, testing_instance_matrix, model [, 'libsvm_options']);

(you can see it in matlab/README)

When I run your code, I get the same decision_values in parallel as normal. So the parallelAccuracy is 0.5, the same as normalAccuracy. Please compare your decision values in normal and parallel to make sure what leads the weird output.

@ZYQue
Copy link
Contributor

ZYQue commented Sep 22, 2019

In addition, I did check your provided models and found they look good. But since you said you only applied OpenMP in prediction, I think it's normal that we can get the same models. If there is something wrong, it may happen on svmpredict(). That's why I want to see the decision values you generate.

@seijikun
Copy link
Author

Oh, I'm sorry, I misunderstood!
Here they are: predictResults.tar.gz

@ZYQue
Copy link
Contributor

ZYQue commented Sep 24, 2019

Hello,

Your decision values in parallel seem abnormal. Since we cannot reproduce your case, it's hard to make a conclusion where is wrong. We recommend you to substitute C for Matlab to avoid other influences. If your result still seems weird, we are pleased to discuss with you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants