O'Reilly logo

Python Deep Learning Cookbook by Indra den Bakker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required