File size: 1,394 Bytes
da4e81c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# -*- coding: utf-8 -*-
"""Vecna.159
Automatically generated by Colab.
Original file is located at
https://colab.research.google.com/drive/1gX09qWUyT9sTqHSCPCRbeAU3veDQ9KOC
"""
!pip install neuralprophet
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from neuralprophet import NeuralProphet
import warnings
warnings.filterwarnings('ignore')
import os
for dirname, _, filenames in os.walk('/content/Meta Dataset.csv'):
for filename in filenames:
print(os.path.join(dirname, filename))
df = pd.read_csv('/content/Meta Dataset.csv')
df.head()
df.info()
df['Date'] = pd.to_datetime(df['Date'])
df.dtypes
df = df[['Date', 'Close']]
df.head()
df.columns = ['ds', 'y']
df.head()
plt.plot(df['ds'], df['y'], label='actual', c='g')
plt.title('Meta Stock Prices Over TIme')
plt.xlabel('Date')
plt.ylabel('Stock Price')
plt.show()
model = NeuralProphet(
batch_size=16
)
model.fit(df)
future = model.make_future_dataframe(df, periods=365)
forecast = model.predict(future)
forecast
actual_prediction = model.predict(df)
plt.plot(df['ds'], df['y'], label='actual', c='g')
plt.plot(actual_prediction['ds'], actual_prediction['yhat1'], label='prediction_actual', c='r')
plt.plot(forecast['ds'], forecast['yhat1'], label='future_prediction', c='b')
plt.xlabel('Date')
plt.ylabel('Stock Price')
plt.legend()
plt.show()
model.plot_components(forecast) |