简体   繁体   English

scipy.optimize.least_squares确定性吗?

[英]Is scipy.optimize.least_squares deterministic?

I am using scipy 's optimize.least_squares algorithm with set initial conditions and always get the same result on my Computer, if however I try this on any other Computer (all with latest Scipy, Python, and bumpy packages and the same 64 Bit Ubuntu Linux), I get different results at each PC. 我正在使用scipyoptimize.least_squares算法和设置初始条件,并且总是在我的计算机上得到相同的结果,但是我在任何其他计算机上尝试这个(所有这些都使用最新的Scipy,Python和颠簸的包以及相同的64位Ubuntu Linux),我在每台PC上得到不同的结果。 Why is this? 为什么是这样?

Thank you. 谢谢。

The answer is yes. 答案是肯定的。

As you can find on the document , there are 3 methods implemented on optimize.least_squares ; 正如您在文档中找到的那样,在optimize.least_squares实现了3种方法;

  1. Trust Region Reflective algorithm 信赖域反射算法
  2. dogleg algorithm with rectangular trust regions 具有矩形信任区域的狗腿算法
  3. Levenberg-Marquardt algorithm Levenberg-Marquardt算法

All of these are iterative methods which start from an initial value (or vector) and go to the minimum value step by step. 所有这些都是迭代方法,从初始值(或向量)开始,逐步进入最小值。 How to determine this step is different from method to method, but is deterministic in all methods. 如何确定此步骤与方法不同,但在所有方法中都是确定性的。
For more detail, you can read this blog written by the developer of this function. 有关更多详细信息,您可以阅读此功能的开发人员撰写的此博客

I'm not sure why you get different results at each PC, sorry. 我不确定为什么你会在每台PC上得到不同的结果,对不起。

By default (if diff_step=None ), optimize.least_squares uses a machine-dependent step size for the finite difference approximation [1]. 默认情况下(如果diff_step=None ), optimize.least_squares使用与机器相关的步长来进行有限差分近似[1]。 For a particular computer, the result should be deterministic, but it could be different on another computer. 对于特定的计算机,结果应该是确定性的,但在另一台计算机上可能会有所不同。

Unless there are other machine-dependent parameters, setting diff_step manually should yield the same results on different machines. 除非存在其他与机器相关的参数, diff_step手动设置diff_step应在不同的机器上产生相同的结果。

[1] See the scipy documentation . [1]请参阅scipy文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM