Scipy differential_evolution initial guess x0 values?
Haapa Mik <[email protected]> Mon, 8 Feb 2021 13:42:11 +0000 (UTC)
| Newsgroups | gmane.comp.python.scientific.user |
|---|---|
| Message-ID | <[email protected]> |
How to pass some good x0 values to differential_evolution so that it does not have to start from "beginning" which is something 1.0435e+16 and then slowly decreasing ... My simplified example. Scoring function func() returns the sum of (yestimate - y)^2 ... sum of error squares and DE is going to minimize it. def func(parameters, *data): k1,k2,k3,v0 = parameters c,j,afff = data result = 0 for i in range(len(c)): result += ( k1*c[i] + k2*j[i] + k3*(j[i]/c[i]) + v0 - (afff[i]) )**2 return result ... result = differential_evolution(func, bounds, args=(args), updating='immediate', workers=1, disp=True, tol=0) ... $ python3 test.py differential_evolution step 5: f(x)= 8.68165e+13 differential_evolution step 6: f(x)= 3.0159e+13 differential_evolution step 7: f(x)= 5.72267e+11 differential_evolution step 8: f(x)= 5.72267e+11 differential_evolution step 9: f(x)= 5.72267e+11 differential_evolution step 10: f(x)= 5.72267e+11 printing result.x [-9.96712308e-04 1.31194421e-03 -9.99999813e+01 1.63032881e+02] printing result.fun 229654.91015705158 How to pass these x0 values [-9.96712308e-04 1.31194421e-03 -9.99999813e+01 1.63032881e+02] to differential_evolution? Br, MH _______________________________________________ SciPy-User mailing list [email protected] https://mail.python.org/mailman/listinfo/scipy-user