Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 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()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement