Skip to content

Instantly share code, notes, and snippets.

@santiagocasas
Last active March 16, 2020 22:09
Show Gist options
  • Save santiagocasas/10403e568b019447b92c4b9cb7288dfd to your computer and use it in GitHub Desktop.
Save santiagocasas/10403e568b019447b92c4b9cb7288dfd to your computer and use it in GitHub Desktop.
optimize
print('>>> Logistic Model')
fit_i = curve_fit(logistic_model,x,y,p0=[3,20,5000], maxfev=10000)#, bounds=([0,0,0],[10,100,150000]))
ai,bi,ci = fit_i[0]
sigma_ai, sigma_bi, sigma_ci = np.sqrt(np.diag(fit_i[1]))
c_pars[(country,'Logistic','a')] = ai
c_pars[(country,'Logistic','b')] = bi
c_pars[(country,'Logistic','c')] = ci
c_pars[(country,'Logistic','sga')] = sigma_ai
c_pars[(country,'Logistic','sgb')] = sigma_bi
c_pars[(country,'Logistic','sgc')] = sigma_ci
print([ss+'='+'{:.3f}'.format(xx) for ss, xx in zip(('a','b','c'),
(ai,bi,ci))])
print([ss+'='+'{:.3f}'.format(xx) for ss, xx in zip(('sigma_a','sigma_b','sigma_c'),
(sigma_ai,sigma_bi,sigma_ci))])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment