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

查看:767
本文介绍了相同的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?

我还从头开始删除并重新安装了蟒蛇,但这没有帮助.

I also removed and reinstalled anaconda from scratch but it didn't help.

推荐答案

我遇到了类似的问题,发现

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天全站免登陆