Skip to content

Instantly share code, notes, and snippets.

@marcosan93
Last active September 26, 2019 22:22
Show Gist options
  • Select an option

  • Save marcosan93/5ae0b66a9415f2ab805af6a4e3add6f7 to your computer and use it in GitHub Desktop.

Select an option

Save marcosan93/5ae0b66a9415f2ab805af6a4e3add6f7 to your computer and use it in GitHub Desktop.
# Loading in the data from before
with open("curr_bitcoin.pickle",'rb') as fp:
ts = pickle.load(fp)
# Resetting the index back so Dates are no longer indexed
ts.reset_index(inplace=True)
# Renaming the columns for use in FB prophet
ts.rename(columns={'Date': 'ds', 'Close': 'y'}, inplace=True)
# Fitting and training
mod = proph(interval_width=0.95)
mod.fit(ts)
# Setting up predictions to be made
future = mod.make_future_dataframe(periods=30, freq='D')
future.tail()
# Making predictions
forecast = mod.predict(future)
# Plotting the model
mod.plot(forecast, uncertainty=True)
plt.title('Facebook Prophet Forecast and Fitting')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment