Last active
September 26, 2019 22:22
-
-
Save marcosan93/5ae0b66a9415f2ab805af6a4e3add6f7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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