相同的 Python 代码,相同的数据,不同机器上的不同结果 [英] Same Python code, same data, different results on different machines

查看:58
本文介绍了相同的 Python 代码,相同的数据,不同机器上的不同结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个很奇怪的问题,我在不同的机器上使用相同的代码和相同的数据得到不同的结果.

I have a very strange problem that I get different results on the same code and same data on different machines.

我有一个基于 numpy/scipy/sklearn 的 python 代码,我使用 anaconda 作为我的基本 python 发行版.即使我将整个项目目录(包括所有数据和代码)从我的主机复制到另一台机器并运行它,我得到的结果也是不同的.具体来说,我正在做一个分类任务,我得到了 3% 的准确度差异.我在两台机器上使用相同版本的 python 和 anaconda.我的主机是 ubuntu 16.04,它的结果低于我尝试过的具有各种操作系统的其他几台机器(OSX、ubuntu 14.04 和 Centos).所以,我当前的系统配置应该有问题,因为所有其他机器显示一致的结果.由于我的 anaconda 版本在所有机器中都是一致的,我不知道还有什么问题.有什么想法我还应该检查什么或问题的根源是什么?

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.

推荐答案

我遇到了类似的问题,我发现 这个讨论.问题可能是 MKL(英特尔数学内核库)浮点运算默认情况下是非确定性的.所以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.

这篇关于相同的 Python 代码,相同的数据,不同机器上的不同结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆