Closed antonykamp closed 3 years ago
I've 3D plotted the objective function vs A and B, and there's a diagonal crossing the global minimum that's rather flat. The diagonal runs, approximately, from (2, 2.2)
to (4, 1.86)
. For comparison, some residual values:
a | b | R |
---|---|---|
3 | 2 | 0 |
2.4131 | 2.1004 | 87.1 |
2 | 2.2 | 493 |
4 | 1.86 | 217 |
1 | 1 | 210232 |
Minimizing this function by calling scipy manually (and without supplying derivatives): minimizer | result |
---|---|
L-BFGS-B | global minimum |
COBYLA | Max function evaluations (1000) reached |
COBYLA with maxiter=10000 | f=32, a=2.63, b=2.06 |
COBYLA with maxiter=10000, tol=1e-8 | global minimum |
trust-constr | global minimum (!) |
trust-constr with jac='cs' | global minimum (!) |
trust-constr with jac='cs', hess=BFGS(exception_strategy='skip_update') | global minimum (!) |
trust-constr with jac=analytical jac, hess='cs' | global minimum (!) |
So we should carefully check the trust-constr wrapping.
Even when the minimizer TrustConstr is advertised in scipy as the most flexible and powerful method available, symfit returns different results for fitting without constraints. For example, as a result of the following code, we get
a=2.4131...
andb=2.1003...
.The same problem exists with COBYLA. Why is that?