問題描述
我有一個(gè)很奇怪的問題,我在不同的機(jī)器上使用相同的代碼和相同的數(shù)據(jù)得到不同的結(jié)果.
I have a very strange problem that I get different results on the same code and same data on different machines.
我有一個(gè)基于 numpy/scipy/sklearn
的 python 代碼,我使用 anaconda
作為我的基本 python 發(fā)行版.即使我將整個(gè)項(xiàng)目目錄(包括所有數(shù)據(jù)和代碼)從我的主機(jī)復(fù)制到另一臺(tái)機(jī)器并運(yùn)行它,我得到的結(jié)果也是不同的.具體來說,我正在做一個(gè)分類任務(wù),我得到了 3% 的準(zhǔn)確度差異.我在兩臺(tái)機(jī)器上使用相同版本的 python 和 anaconda.我的主機(jī)是 ubuntu 16.04,它的結(jié)果低于我嘗試過的具有各種操作系統(tǒng)的其他幾臺(tái)機(jī)器(OSX、ubuntu 14.04 和 Centos).所以,我當(dāng)前的系統(tǒng)配置應(yīng)該有問題,因?yàn)樗衅渌麢C(jī)器顯示一致的結(jié)果.由于我的 anaconda 版本在所有機(jī)器中都是一致的,我不知道還有什么問題.有什么想法我還應(yīng)該檢查什么或問題的根源是什么?
I have a python code based on numpy/scipy/sklearn
and I use anaconda
as my base python distribution. Even when I copy the entire project directory (which includes all the data and code) from my main machine to another machine and run it, the results I get are different. Specifically, I'm doing a classification task and I get 3 percent difference in accuracy. I am using the same version of python and anaconda on the two machines. My main machine is ubuntu 16.04 and the results on it are lower than several other machines with various OS on which I tried (OSX, ubuntu 14.04 and Centos). So, there should be something wrong with my current system configuration because all other machines show consistent results. Since the version of my anaconda is consistent among all machines, I have no idea what else could be the problem. Any ideas what else I should check or what could be the source of the problem?
我還從頭開始刪除并重新安裝了 anaconda,但沒有幫助.
I also removed and reinstalled anaconda from scratch but it didn't help.
推薦答案
我遇到了類似的問題,我發(fā)現(xiàn) 這個(gè)討論.問題可能是 MKL(英特爾數(shù)學(xué)內(nèi)核庫)浮點(diǎn)運(yùn)算默認(rèn)情況下是非確定性的.所以export MKL_CBWR=AUTO
或許可以解決問題.
I had a similar problem and I found this discussion. May be the problem is that MKL(Intel Math Kernel Library) float point operations are non-deterministic by default. So export MKL_CBWR=AUTO
may solve the problem.
這篇關(guān)于相同的 Python 代碼,相同的數(shù)據(jù),不同機(jī)器上的不同結(jié)果的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!