fitcsvm with identical variables gives different result on different machines

3 ビュー (過去 30 日間)
fireattack 2016 年 9 月 18 日
コメント済み: kc 2019 年 6 月 19 日
I encountered this weird problem and it totally messed up my experiment data (i.e. I can't reproduce same thing on two computers), so I did some testing and find that it's caused by fitcsvm function.
I made a simple steps of reproduction so you can give it a try, if you're curious. It requires Statistics and Machine Learning Toolbox.
  1. Download the data from this MAT file:
  2. The code below, which is a simplified example derived from my research:
clear all
SVMModel = fitcsvm(inputs,outputs,'KernelFunction','rbf',...
Note: from what I can tell, fitcsvm function (at least with my inputs) doesn't contain anything that is random seed based. But just in case, I added rng(90) before. It really doesn't have any effect on this bug, though (tested).
So, with this simple code, I can get 2 different results on 5 computers in total (all of them are 64-bit MATLAB)
Result no.1:
Can be reproduced on:
  1. My laptop: OS: Microsoft Windows 7 Ultimate; Matlab: R2016a
  2. My uni's supercomputer: OS: Linux 2.6.32-642.3.1.el6.x86_64 #1 SMP Tue Jul 12 18:30:56 UTC 2016 x86_64; Matlab: R2016a
  3. My uni's lab computer: OS: Win 10; R2016a
Result no.2:
Can be reproduced on:
  1. A virtual desktop provided by my university: OS: Microsoft Windows 8.1 Enterprise; Matlab: R2016a
  2. My desktop computer, OS: Win 7; Matlab: R2016a / R2016b
As you can see, they seem totally random: two of my personal computers have same OS, but it gives different answers.
All the MATLAB have academic license.
If anyone can help, it would be very appreciated.
  3 件のコメント
Walter Roberson
Walter Roberson 2016 年 9 月 19 日
I have tried a couple of different configurations here, native or virtual machines; so far I have only seen Result #1. I am loading up a Windows 8 virtual machine now to test on.



Ilya 2016 年 9 月 20 日
My guess is that gradients for two or more observations become equal within floating-point accuracy during optimization. The solver then picks one observation for update in one setup and another observation in another setup. From that point on, the optimization paths are different.
Such problems arise when you have discrete predictors. Your predictors 3 to 6 have 4 distinct values each. If you add a small amount of white noise to your predictors, I suspect the results returned in all configurations are going to be identical (or almost identical).
Standardizing the data would likely improve learning as well since the standard deviations for predictors 3 and 6 differ by two orders of magnitude.
  2 件のコメント
kc 2019 年 6 月 19 日
Can SVM using on matlab 2015 and 2018 can give diffrent results.Plese guide.


その他の回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by