how to find the best parameters to solve a differential equation?

I have a differential equation:

def func(Y, t, r, p, K, alpha):
    return r * (Y ** p) * (1 - (Y / K) ** alpha)

and I want to find the best parameters that fit (r,p,K,alpha). I tried to use curve fit but it was too bad, this is my code

# I chose the value of maxfev randomly
popt, pcov = curve_fit(func, df.index, df.Value,method='lm',maxfev = 8000)

t = np.linspace(0, len(df), len(df))
y0 = popt[0]
params = (popt[1], popt[2], popt[3], popt[4]) # r, p, K, alpha
sol = odeint(func, y0, t, args=params)

and this the plot:

Note: this is how my real data looks like:

what I'm looking for it the best values for (r,p,K and alpha), how to find them?

Topic parameter-estimation implementation parameter optimization python

Category Data Science


If nothing else is possible, you could try using a genetic algorithm.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.