Keras Deep Learning Cookbook
eBook - ePub

Keras Deep Learning Cookbook

Over 30 recipes for implementing deep neural networks in Python

Rajdeep Dua, Manpreet Singh Ghotra

Compartir libro
  1. 252 páginas
  2. English
  3. ePUB (apto para móviles)
  4. Disponible en iOS y Android
eBook - ePub

Keras Deep Learning Cookbook

Over 30 recipes for implementing deep neural networks in Python

Rajdeep Dua, Manpreet Singh Ghotra

Detalles del libro
Vista previa del libro
Índice
Citas

Información del libro

Leverage the power of deep learning and Keras to develop smarter and more efficient data models

Key Features

  • Understand different neural networks and their implementation using Keras
  • Explore recipes for training and fine-tuning your neural network models
  • Put your deep learning knowledge to practice with real-world use-cases, tips, and tricks

Book Description

Keras has quickly emerged as a popular deep learning library. Written in Python, it allows you to train convolutional as well as recurrent neural networks with speed and accuracy.

The Keras Deep Learning Cookbook shows you how to tackle different problems encountered while training efficient deep learning models, with the help of the popular Keras library. Starting with installing and setting up Keras, the book demonstrates how you can perform deep learning with Keras in the TensorFlow. From loading data to fitting and evaluating your model for optimal performance, you will work through a step-by-step process to tackle every possible problem faced while training deep models. You will implement convolutional and recurrent neural networks, adversarial networks, and more with the help of this handy guide. In addition to this, you will learn how to train these models for real-world image and language processing tasks.

By the end of this book, you will have a practical, hands-on understanding of how you can leverage the power of Python and Keras to perform effective deep learning

What you will learn

  • Install and configure Keras in TensorFlow
  • Master neural network programming using the Keras library
  • Understand the different Keras layers
  • Use Keras to implement simple feed-forward neural networks, CNNs and RNNs
  • Work with various datasets and models used for image and text classification
  • Develop text summarization and reinforcement learning models using Keras

Who this book is for

Keras Deep Learning Cookbook is for you if you are a data scientist or machine learning expert who wants to find practical solutions to common problems encountered while training deep learning models. A basic understanding of Python and some experience in machine learning and neural networks is required for this book.

Preguntas frecuentes

¿Cómo cancelo mi suscripción?
Simplemente, dirígete a la sección ajustes de la cuenta y haz clic en «Cancelar suscripción». Así de sencillo. Después de cancelar tu suscripción, esta permanecerá activa el tiempo restante que hayas pagado. Obtén más información aquí.
¿Cómo descargo los libros?
Por el momento, todos nuestros libros ePub adaptables a dispositivos móviles se pueden descargar a través de la aplicación. La mayor parte de nuestros PDF también se puede descargar y ya estamos trabajando para que el resto también sea descargable. Obtén más información aquí.
¿En qué se diferencian los planes de precios?
Ambos planes te permiten acceder por completo a la biblioteca y a todas las funciones de Perlego. Las únicas diferencias son el precio y el período de suscripción: con el plan anual ahorrarás en torno a un 30 % en comparación con 12 meses de un plan mensual.
¿Qué es Perlego?
Somos un servicio de suscripción de libros de texto en línea que te permite acceder a toda una biblioteca en línea por menos de lo que cuesta un libro al mes. Con más de un millón de libros sobre más de 1000 categorías, ¡tenemos todo lo que necesitas! Obtén más información aquí.
¿Perlego ofrece la función de texto a voz?
Busca el símbolo de lectura en voz alta en tu próximo libro para ver si puedes escucharlo. La herramienta de lectura en voz alta lee el texto en voz alta por ti, resaltando el texto a medida que se lee. Puedes pausarla, acelerarla y ralentizarla. Obtén más información aquí.
¿Es Keras Deep Learning Cookbook un PDF/ePUB en línea?
Sí, puedes acceder a Keras Deep Learning Cookbook de Rajdeep Dua, Manpreet Singh Ghotra en formato PDF o ePUB, así como a otros libros populares de Informatique y Réseaux de neurones. Tenemos más de un millón de libros disponibles en nuestro catálogo para que explores.

Información

Año
2018
ISBN
9781788623087
Edición
1
Categoría
Informatique

Recurrent Neural Networks

In this chapter, we will cover the following recipes:
  • Simple RNNs for time series data
  • LSTM networks for time series data
  • LSTM memory example time series forecasting with LSTM
  • Sequence to sequence learning for the same length output with LSTM

Introduction

In this chapter, we will learn various recipes on how to create recurrent neural networks (RNNs) using Keras. First, we will understand the need for RNN. We will start with the simple RNNs followed by long short-term memory (LSTM) RNNs (these networks remember the state over a long period of time because of special gates in the cell).

The need for RNNs

Traditional neural networks cannot remember their past interactions, and that is a significant shortcoming. RNNs address this issue. They are networks with loops in them, allowing information to persist. RNNs have loops. In the next diagram, a chunk of the neural network, A, looks at some input, xt, and outputs a value, ht. A loop in the network allows information to be passed from one step of the network to the next.
This diagram shows what a neural network looks like:

Simple RNNs for time series data

In this recipe, we will learn how to use a simple RNN implementation of Keras to predict sales based on a historical dataset.
RNNs are a class of artificial neural network where connections between nodes of the network form a directed graph along a sequence. This topology allows it to exhibit dynamic temporal behavior for input of the time sequence type. Unlike feedforward neural networks, RNNs can use their internal state (also called memory) to process sequences of inputs. This makes them suitable for tasks such as unsegmented, connected handwriting recognition or speech recognition.
A simple RNN is implemented as part of the keras.layers.SimpleRNN class as follows:
keras.layers.SimpleRNN(units, activation='tanh', 
use_bias=True,
kernel_initializer='glorot_uniform',
recurrent_initializer='orthogonal',
bias_initializer='zeros',
kernel_regularizer=None,
recurrent_regularizer=None,
bias_regularizer=None,
activity_regularizer=None,
kernel_constraint=None,
recurrent_constraint=None,
bias_constraint=None,
dropout=0.0,
recurrent_dropout=0.0,
return_sequences=False,
return_state=False,
go_backwards=False,
stateful=False,
unroll=False)
A simple RNN is a fully-connected RNN where the output is to be fed back to the input. We will be using a simple RNN for time series prediction.

Getting ready

The dataset is in this file: sales-of-shampoo-over-a-three-ye.csv. It has two columns, the first for months and the second for sales figures for each month, as follows:
"Month","Sales of shampoo over a three year period"
"1-01",266.0
"1-02",145.9
"1-03",183.1
"1-04",119.3
"1-05",180.3
"1-06",168.5
"1-07",231.8
First, we need to import the relevant classes, as follows:
from pandas import read_csv
from matplotlib import pyplot
from pandas import datetime

Loading the dataset

  1. We define a parser to convert YY to YYYY, shown as follow:
def parser(x):
return datetime.strptime('200' + x, '%Y-%m')
  1. Next, call the read_csv function of pandas to load a .csv file into a pandas DataFrame.
Notice the data parser being used is the function defined previously.
  1. The next read_csv function is called in the next code:
series = read_csv('sales-of-shampoo-over-a-three-ye.csv', header=0, parse_dates=[0], index_col=0, 
squeeze=True, date_parser=parser)
  1. Once the series is loaded, let's summarize the first few rows:
print(series.head())
The output of the preceding code is as follows:
Month
2001-01-01 266.0
2001-02-01 145.9
2001-03-01 183.1
2001-04-01 119.3
2001-05-01 180.3
  1. Next, let's print the line plot using the pyplot library:
series.plot()
pyplot.show()
The...

Índice