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.52k stars 1.64k forks source link

Different probability estimates obtained from Matlab running on Unix and Windows #176

Open yaoyang1 opened 3 years ago

yaoyang1 commented 3 years ago

Hi, I tried to run 'svmtrain' with the same training data on both Ubuntu(64bit) and Windows(64bit). My MATLAB on both is R2020b(64bit). The SVM models derived were exactly the same. However, I got different probability estimates (i.e., model.ProbA and model.ProbB). The code follows.

t=2; c=1; g=1; b=1; cmd=['-t ',num2str(t) , ' -c ', num2str(c), ' -g ', num2str(g), ' -q -b ', num2str(b)]; model=svmtrain(y, x, cmd); display(model.ProbA,'A') display(model.ProbB,'B')

'x' is the input and 'y' is the output. Both are of type double. Thank you.

cjlin1 commented 3 years ago

For getting prob outputs internally there is a 5-fold CV procedure. So randomness occurs.

On 2021-07-06 10:07, yaoyang1 wrote:

Hi, I tried to run 'svmtrain' with the same training data on both Ubuntu(64bit) and Windows(64bit). My MATLAB on both is R2020b(64bit). The SVM models derived were exactly the same. However, I got different probability estimates (i.e., model.ProbA and model.ProbB). The code follows.

t=2; c=1; g=1; b=1; cmd=['-t ',num2str(t) , ' -c ', num2str(c), ' -g ', num2str(g), ' -q -b ', num2str(b)]; model=svmtrain(y, x, cmd); display(model.ProbA,'A') display(model.ProbB,'B')

'x' is the input and 'y' is the output. Both are of type double. Thank you.

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

Links:

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

yaoyang1 commented 3 years ago

Thank you for the quik response. I understand the 5-fold CV procedure. I trid to repeatedly run the same code several times on the same platform, say Win10, but the results (probability estimates) did not change. I'm not sure if there is a initialization procedure of the random number generator in your code. Anyway, I think this might not be the reason why I got different results from the same code on Ubuntu and Windows. Do you have any other ideas why this could happen?

yaoyang1 commented 3 years ago

FYI, I'm using the same libsvm version, i.e. libsvm 3.25.

cjlin1 commented 3 years ago

On some systems (e.g. GNU C) the default seed is the same (i.e., 1). Thus you get same results across different runs. But on other systems their random seeds are different in different runs

On 2021-07-06 11:05, Yang Yao wrote:

FYI, I'm using the same libsvm version, i.e. libsvm 3.25.

-- You are receiving this because you commented. Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. [ { @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": "https://github.com/cjlin1/libsvm/issues/176#issuecomment-874425298", "url": "https://github.com/cjlin1/libsvm/issues/176#issuecomment-874425298", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { @.": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

Links:

[1] https://github.com/cjlin1/libsvm/issues/176#issuecomment-874425298 [2] https://github.com/notifications/unsubscribe-auth/ABI3BHRX3LWMGK5TLNCRWE3TWJXJLANCNFSM473TXEJQ

yaoyang1 commented 3 years ago

Got it. Thanks!