-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.py
34 lines (30 loc) · 1.01 KB
/
Main.py
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
import numpy as np
import pandas_datareader as web
from pandas import concat
from sklearn.metrics import mean_squared_error
from Persistance_Algorithm import Persistance_Alg
import datetime
from LSTM import LSTM_Alg
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
from sklearn.preprocessing import MinMaxScaler
import Data_preprocess as DPrep
start = datetime.datetime(2004,1,1)
end = datetime.date.today()
Google_data = web.DataReader("GOOG", "yahoo", start, end)
Adj_Close = Google_data["Adj Close"]
del Google_data['Close']
del Google_data['Low']
del Google_data['High']
del Google_data['Volume']
Persistance_model = Persistance_Alg(Adj_Close)
LSTM_model = LSTM_Alg(Google_data)
fig = plt.figure()
ax = fig.add_subplot(111)
LSTM_model.data['prediction'].plot(grid = True, label = 'LSTM')
LSTM_model.data['Adj Close'].plot(grid = True, label = 'Actual USD Value')
plt.ylabel('Price USD')
plt.xlabel('Date')
ax.set_title('LSTM Prediction')
ax.legend(loc='upper left')
plt.show()