Skip to content

Instantly share code, notes, and snippets.

@barce
Created May 13, 2020 22:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barce/9871ca545ca096defd84a2311b77890a to your computer and use it in GitHub Desktop.
Save barce/9871ca545ca096defd84a2311b77890a to your computer and use it in GitHub Desktop.
polyfit for prediction
def predict_stats(a_stats, i_days):
x = np.array( list(range(0,len(a_stats))) )
y = np.array(a_stats)
z = np.polyfit(x,y,3) # construct x**2 + xy + 3
p_true = np.poly1d(z)
return p_true(len(a_stats) + i_days)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment