How to do it...

  1. We start by importing all the libraries, as follows:
import matplotlib.pyplot as pltimport numpy as npimport pandas as pdfrom sklearn.preprocessing import MinMaxScalerfrom keras.layers.core import Dense, Activation, Dropoutfrom keras.layers.recurrent import LSTMfrom keras.models import Sequential
  1. Let's load the data and print the first rows:
data = pd.read_csv('Data/stock-data-2000-2017.csv')# Reorder the columns for conveniencedata = data[['Open', 'High', 'Low', 'Volume', 'Close']]data.head()

The following figure shows the output of the preceding code:

Figure 10.1: First five entries of the stock dataset
  1. Before we move ...

Get Python Deep Learning Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.