Professional Documents
Culture Documents
In [62]: np.random.seed(7)
Out[63]:
Local time Open High Low Close Volume
In [64]: msft_dataset.dtypes
<class 'pandas.core.frame.DataFrame'>
Index: 110880 entries, 01.04.2018 00:00:00.000 to 16.06.2018 23:59:00.000
Data columns (total 5 columns):
Open 110880 non-null float64
High 110880 non-null float64
Low 110880 non-null float64
Close 110880 non-null float32
Volume 110880 non-null float64
dtypes: float32(1), float64(4)
memory usage: 4.7+ MB
Out[69]: array([[0.8963785 ],
[0.8963785 ],
[0.8963785 ],
...,
[0.10328674],
[0.10328674],
[0.10328674]], dtype=float32)
series = 60
In [72]: trainX
In [73]: trainX[0]
In [74]: trainX[7517]
Epoch 1/1
77555/77555 [==============================] - 43s - loss: 0.0072
In [80]: #lets plot the predictions on a graph and see how well it did
train_plot = np.empty_like(msft_close)
train_plot[:,:] = np.nan
train_plot[series:len(trainPredictions)+series, :] = trainPredictions
test_plot = np.empty_like(msft_close)
test_plot[:,:] = np.nan
test_plot[len(trainPredictions)+(series*2)+1:len(msft_close)-1, :] = testPredictions
#plot on graph
plt.rcParams["figure.figsize"] = [80,32]
plt.plot(scaler.inverse_transform(msft_close))
plt.plot(train_plot)
plt.plot(test_plot)
In [57]: