Skip to content
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

Fix results of scipy.optimize between OS #310

Open
rhugonnet opened this issue Sep 27, 2022 · 1 comment
Open

Fix results of scipy.optimize between OS #310

rhugonnet opened this issue Sep 27, 2022 · 1 comment

Comments

@rhugonnet
Copy link
Contributor

rhugonnet commented Sep 27, 2022

The output of scipy.optimize.basinhopping varies between operating systems, added TODOs in the tests in #304. It does not look like it's due to the random seed that seems correctly passed, but the output tolerance.
For scipy.optimize.least_squares, I managed to have the same results on different OS by rounding the result 100 times above the variable tolerance xtol provided to the optimize function (not sure if it's 100% robust, need to think more on it).

For basinhopping and the method we use in it, one can only pass ftol (cost function) or gtol (gradient), which does not translate directly into xtol (variables of interest). So the tolerances might be too low compared to the rounding, hence different results on different OS. The equations of the tolerances are provided in the scipy doc, so we should be able to work back the influence on the variable tolerance to ensure all results are fixed.

@rhugonnet rhugonnet changed the title Fix results of scipy.optimize.basinhopping between OS Fix results of scipy.optimize between OS Oct 13, 2022
@rhugonnet
Copy link
Contributor Author

Update: in the PR #304, the output of scipy.optimize.least_squares after rounding with a lower tolerance than xtol is the same for Linux and Windows, but not for Mac.
Need to find a way to solve this more robustly...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant