-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cuve_fit
results are inconsistent over different CPU / Linux distro
#20686
Comments
Not entirely surprising. Floating point arithmetic can differ between CPUs. You have a degenerate model with a number of symmetries, so the local optimizer's path will end up having a number of branching points in the loss function that differing floating point calculations could send it down, creating large differences in the final result despite the small differences in any given floating point calculation. You could try to help this by reparameterizing your model and applying constraints so that you don't have as many symmetries. For example, consider representing the means as I don't think there's much we can do about it on our end. CPU differences in floating point arithmetic are a thing, and we don't have much control over it. |
This strikes me as a problem which Example:
Result: This looks better to me than either of the results that |
@rkern @nickodell Thank you for the comments and opinions. Maybe I have to admit that would not be possible to completely avoid the small discrepancy coming from CPU architecture. I've had a chance to test I suspected numerical error when numerically computing the gradient, so I've come up with providing analytical Jacobian function into |
Describe your issue.
It has come to our attention that the
curve_fit
function inscipy.optimize
produces different fitting results across platforms, even when running identical code and using the same data samples as shown in the sample code below.The function in question models a trimodal distribution, which is the sum of three Gaussian functions with varying means, standard deviations, and amplitudes (or peak heights).
The fitting results differ across platforms, as detailed in the
Error message
section below.Reproducing Code Example
Error message
AMD EPYC 7663, CentOS Linux 7
The text was updated successfully, but these errors were encountered: