I am having trouble with an optimization that used to work with a previous version of python...
I have a function fp = lambda c, x: (c[0])+ (c[1]*((1- np.exp(-x/c[4]))/(x/c[4])))+ (c[2]*((((1-np.exp(-x/c[4]))/(x/c[4])))- (np.exp(-x/c[4]))))+ (c[3]*((((1-np.exp(-x/c[5]))/(x/c[5])))- (np.exp(-x/c[5]))))
and I need to minimize the error e = lambda c, x, y: (((fp(c,x)-y)**2).sum())
using the initial parameter values p0 = np.array([0.01,0.01,0.01,0.01,0.01,1.00,1.00])
basically p = optimize.fmin(e, p0, args=(x,y))
were x and y are np.arrays (14,) each.
So, this used to work but now it throws this error TypeError: loop of ufunc does not support argument 0 of type float which has no callable exp method
I've done some research and it seems that there is a problem related to np.exp()
and some versions of Numpy ... Actually this problem appeared when I updated Python and Numpy as well to 3.7 and 1.18.1 repectively.
Any thoughts?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…