Monday 15 June 2015

python - Different results with scipy.optimize.curve_fit using list and array -


To fit a set of 2D elements using a 3 parameter, scipy.optimize.curve_fit Exponential function, if I treat lists containing data in the form of list or numpy arrays , then I get wildly different results. MWE is below

Last Fit parameter value, ABC are:

  Last ABC: [1.3 9 852692e-10 1.00000000 E + 00 1.39020816e-01 ]  

for the function calculates using the list ( exp_3p ), and:

  FINAL ABC MMP: [0.00826326 0.18603007 -0.02641734]  

For a function using a narrow array ( exp_3p_np ).

I am quite sure that this is related to temporary point accuracy while using an Aurora, but if I can get confirmation (and possibly some other information) from someone with a more knowledge on it would be great.


Add

This is apparently a scipy 0.12.0 problem, which is installed in my system The version is when I tried to do it. I have upgraded to 0.14.0 , I run the code again and now the two functions give the exact same value.


MWE

  import Apeepiapi (X, A, B, C): a Anpi.akspi * (b * x) + C DRF Akspifaipiapeepiananpi (X, A, B, C) return: * NP return to .exp (b * np.asarray (x)) + cx = [11.250861, 11.750861, 12.250861, 12.750861, 13.250861, 13.750861, 14.250861, 14.750861, 15.250861, 15.750861, 16.250861 , 16.750861, 17.250861, 17.750861, 18.250861, 18.750861, 1 9 .250861, 19.750861, 20.250861, 20.750861, 21.250861, 21.750861] y = [.045588760000000006, .046796000000000004, 0.05,56, 9, 35, 0.0634055 , .083095124999999992, .092670656249999997, .098264620000000011, .086176929999999999, 0.10626 9 6625, .124142703125, 0.13172655, .13762596999999999, .17699458749999999, 12:20 194234375, .19936675000000001, .24553768749999999, .28308924000000002, 0.3130, 945, .35024002999999998, 0.39341382000000003, 0.40971550000000 001, 0.40854391000000001] popt, pcov = curve_fit (exp_3p, x, y) print \ nFINAL abc : ', popt popt, pcov = curve_fit (exp_3p_np, x, y) print' \ nFINAL abc numpy: ', popt  


No comments:

Post a Comment