Skip to content

Instantly share code, notes, and snippets.

@santiagocasas
Last active March 16, 2020 12:34
Show Gist options
  • Save santiagocasas/545c589d7c9d7e45d77ad218c95ef5af to your computer and use it in GitHub Desktop.
Save santiagocasas/545c589d7c9d7e45d77ad218c95ef5af to your computer and use it in GitHub Desktop.
asymptote and metrics
y_pred = logistic_model(x,ai,bi,ci)
MSLE=sklm.mean_squared_log_error(y,y_pred)
print("Mean squared log error (MSLE): ", '{:.3f}'.format(MSLE))
print("Exp of RMSLE: ", '{:.3f}'.format(np.exp(np.sqrt(MSLE))))
print("R2 score: ", '{:.3f}'.format(sklm.r2_score(y,y_pred)))
perc_flat = 0.98
sol = int(fsolve(lambda x : logistic_model(x,ai,bi,ci) - perc_flat*int(ci), bi))
print('Day of flattening of the infection curve')
datesol = datetime.strftime(df_dict[country].index[0] + timedelta(days=sol), ' %d, %b %Y' )
print('-->'+datesol)
c_pars[(country,'Logistic','c_time')] = sol
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment