From charlesr.harris at gmail.com Sun Feb 7 16:23:04 2021 From: charlesr.harris at gmail.com (Charles R Harris) Date: Sun, 7 Feb 2021 14:23:04 -0700 Subject: [SciPy-User] NumPy 1.20.1 released. Message-ID: Hi All, On behalf of the NumPy team I am pleased to announce the release of NumPy 1.20.1. NumPy 1.20.1 is a rapid bugfix release fixing several bugs and regressions reported after the 1.20.0 release. The Python versions supported for this release are 3.7-3.9. Wheels can be downloaded from PyPI ; source archives, release notes, and wheel hashes are available on Github . Linux users will need pip >= 0.19.3 in order to install manylinux2010 and manylinux2014 wheels. *Highlights* - The distutils bug that caused problems with downstream projects is fixed. - The ``random.shuffle`` regression is fixed. *Contributors* A total of 8 people contributed to this release. People with a "+" by their names contributed a patch for the first time. - Bas van Beek - Charles Harris - Nicholas McKibben + - Pearu Peterson - Ralf Gommers - Sebastian Berg - Tyler Reddy - @Aerysv + *Pull requests merged* A total of 15 pull requests were merged for this release. - gh-18306: MAINT: Add missing placeholder annotations - gh-18310: BUG: Fix typo in ``numpy.__init__.py`` - gh-18326: BUG: don't mutate list of fake libraries while iterating over... - gh-18327: MAINT: gracefully shuffle memoryviews - gh-18328: BUG: Use C linkage for random distributions - gh-18336: CI: fix when GitHub Actions builds trigger, and allow ci skips - gh-18337: BUG: Allow unmodified use of isclose, allclose, etc. with timedelta - gh-18345: BUG: Allow pickling all relevant DType types/classes - gh-18351: BUG: Fix missing signed_char dependency. Closes #18335. - gh-18352: DOC: Change license date 2020 -> 2021 - gh-18353: CI: CircleCI seems to occasionally time out, increase the limit - gh-18354: BUG: Fix f2py bugs when wrapping F90 subroutines. - gh-18356: MAINT: crackfortran regex simplify - gh-18357: BUG: threads.h existence test requires GLIBC > 2.12. - gh-18359: REL: Prepare for the NumPy 1.20.1 release. Cheers, Charles Harris -------------- next part -------------- An HTML attachment was scrubbed... URL: From haapamik at yahoo.com Mon Feb 8 08:42:11 2021 From: haapamik at yahoo.com (Haapa Mik) Date: Mon, 8 Feb 2021 13:42:11 +0000 (UTC) Subject: [SciPy-User] Scipy differential_evolution initial guess x0 values? References: <527807237.822986.1612791731792.ref@mail.yahoo.com> Message-ID: <527807237.822986.1612791731792@mail.yahoo.com> 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 From warren.weckesser at gmail.com Tue Feb 9 11:02:46 2021 From: warren.weckesser at gmail.com (Warren Weckesser) Date: Tue, 9 Feb 2021 11:02:46 -0500 Subject: [SciPy-User] Scipy differential_evolution initial guess x0 values? In-Reply-To: <527807237.822986.1612791731792@mail.yahoo.com> References: <527807237.822986.1612791731792.ref@mail.yahoo.com> <527807237.822986.1612791731792@mail.yahoo.com> Message-ID: On 2/8/21, Haapa Mik wrote: > 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? > The `init` parameter allows you to specify the initial population that is used by the algorithm. The parameter is expected to be an array containing at least five guesses. If you have a pretty good guess for the solution, you could create a cluster of candidates around that guess. Here's a simple example. The objective function has a minimum at [1, 1]. ----- In [104]: from scipy.optimize import differential_evolution In [105]: def objective(x): ...: x = np.array(x) ...: return np.sum((x - 1)**2) ...: In [106]: differential_evolution(objective, [[-25, 25], [-25, 25]], tol=1e-9) Out[106]: fun: 1.5777218104420236e-30 message: 'Optimization terminated successfully.' nfev: 2793 nit: 92 success: True x: array([1., 1.]) ----- Create a cluster of 15 points around [1, 1], and use them as the init parameter. ----- In [130]: x0 = np.random.multivariate_normal([1, 1], 0.02*np.eye(2), size=15) In [131]: x0 Out[131]: array([[0.99181517, 1.24919039], [1.10938275, 0.97639551], [0.6991003 , 1.05940167], [1.18903841, 0.990736 ], [1.1369098 , 0.94895271], [0.64620631, 1.19959699], [0.86884416, 1.07479914], [0.93342624, 1.15701549], [0.93504748, 1.16624753], [0.92176135, 1.05270535], [1.07944635, 1.03205849], [0.94648726, 0.99061289], [1.14088686, 0.89811341], [1.23903334, 1.09125584], [1.12380905, 0.88606074]]) In [132]: differential_evolution(objective, [[-25, 25], [-25, 25]], tol=1e-9, init=x0) Out[132]: fun: 1.5777218104420236e-30 message: 'Optimization terminated successfully.' nfev: 1173 nit: 77 success: True x: array([1., 1.]) ----- Warren > Br, MH > _______________________________________________ > SciPy-User mailing list > SciPy-User at python.org > https://mail.python.org/mailman/listinfo/scipy-user > From andyfaff at gmail.com Tue Feb 9 12:51:52 2021 From: andyfaff at gmail.com (Andrew Nelson) Date: Wed, 10 Feb 2021 04:51:52 +1100 Subject: [SciPy-User] Scipy differential_evolution initial guess x0 values? In-Reply-To: References: <527807237.822986.1612791731792.ref@mail.yahoo.com> <527807237.822986.1612791731792@mail.yahoo.com> Message-ID: Scipy 1.7.0 will have an `x0` keyword that can specify an initial guess instead of having to specify an initial population. -------------- next part -------------- An HTML attachment was scrubbed... URL: From haapamik at yahoo.com Tue Feb 9 13:10:02 2021 From: haapamik at yahoo.com (Haapa Mik) Date: Tue, 9 Feb 2021 18:10:02 +0000 (UTC) Subject: [SciPy-User] Scipy differential_evolution initial guess x0 values? In-Reply-To: References: <527807237.822986.1612791731792.ref@mail.yahoo.com> <527807237.822986.1612791731792@mail.yahoo.com> Message-ID: <354383059.3049504.1612894202982@mail.yahoo.com> This is great news! I am going to wait for Scipy 1.7 version release. The init= way is too difficult for me. Thank you both! -MH On Tuesday, February 9, 2021, 07:52:38 PM GMT+2, Andrew Nelson wrote: Scipy 1.7.0 will have an `x0` keyword that can specify an initial guess instead of having to specify an initial population.