Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. # Loading in the data from before
  2. with open("curr_bitcoin.pickle",'rb') as fp:
  3. ts = pickle.load(fp)
  4.  
  5. # Resetting the index back so Dates are no longer indexed
  6. ts.reset_index(inplace=True)
  7.  
  8. # Renaming the columns for use in FB prophet
  9. ts.rename(columns={'Date': 'ds', 'Close': 'y'}, inplace=True)
  10.  
  11. # Fitting and training
  12. mod = proph(interval_width=0.95)
  13. mod.fit(ts)
  14.  
  15. # Setting up predictions to be made
  16. future = mod.make_future_dataframe(periods=30, freq='D')
  17. future.tail()
  18.  
  19. # Making predictions
  20. forecast = mod.predict(future)
  21.  
  22. # Plotting the model
  23. mod.plot(forecast, uncertainty=True)
  24. plt.title('Facebook Prophet Forecast and Fitting')
  25. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement