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

  1. 252 pages
  2. English
  3. ePUB (adapté aux mobiles)
  4. Disponible sur iOS et Android
eBook - ePub

Keras Deep Learning Cookbook

Over 30 recipes for implementing deep neural networks in Python

Rajdeep Dua, Manpreet Singh Ghotra

DĂ©tails du livre
Aperçu du livre
Table des matiĂšres
Citations

À propos de ce livre

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.

Foire aux questions

Comment puis-je résilier mon abonnement ?
Il vous suffit de vous rendre dans la section compte dans paramĂštres et de cliquer sur « RĂ©silier l’abonnement ». C’est aussi simple que cela ! Une fois que vous aurez rĂ©siliĂ© votre abonnement, il restera actif pour le reste de la pĂ©riode pour laquelle vous avez payĂ©. DĂ©couvrez-en plus ici.
Puis-je / comment puis-je télécharger des livres ?
Pour le moment, tous nos livres en format ePub adaptĂ©s aux mobiles peuvent ĂȘtre tĂ©lĂ©chargĂ©s via l’application. La plupart de nos PDF sont Ă©galement disponibles en tĂ©lĂ©chargement et les autres seront tĂ©lĂ©chargeables trĂšs prochainement. DĂ©couvrez-en plus ici.
Quelle est la différence entre les formules tarifaires ?
Les deux abonnements vous donnent un accĂšs complet Ă  la bibliothĂšque et Ă  toutes les fonctionnalitĂ©s de Perlego. Les seules diffĂ©rences sont les tarifs ainsi que la pĂ©riode d’abonnement : avec l’abonnement annuel, vous Ă©conomiserez environ 30 % par rapport Ă  12 mois d’abonnement mensuel.
Qu’est-ce que Perlego ?
Nous sommes un service d’abonnement Ă  des ouvrages universitaires en ligne, oĂč vous pouvez accĂ©der Ă  toute une bibliothĂšque pour un prix infĂ©rieur Ă  celui d’un seul livre par mois. Avec plus d’un million de livres sur plus de 1 000 sujets, nous avons ce qu’il vous faut ! DĂ©couvrez-en plus ici.
Prenez-vous en charge la synthÚse vocale ?
Recherchez le symbole Écouter sur votre prochain livre pour voir si vous pouvez l’écouter. L’outil Écouter lit le texte Ă  haute voix pour vous, en surlignant le passage qui est en cours de lecture. Vous pouvez le mettre sur pause, l’accĂ©lĂ©rer ou le ralentir. DĂ©couvrez-en plus ici.
Est-ce que Keras Deep Learning Cookbook est un PDF/ePUB en ligne ?
Oui, vous pouvez accĂ©der Ă  Keras Deep Learning Cookbook par Rajdeep Dua, Manpreet Singh Ghotra en format PDF et/ou ePUB ainsi qu’à d’autres livres populaires dans Informatique et RĂ©seaux de neurones. Nous disposons de plus d’un million d’ouvrages Ă  dĂ©couvrir dans notre catalogue.

Informations

Année
2018
ISBN
9781788623087
Édition
1

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

Table des matiĂšres

  1. Title Page
  2. Copyright and Credits
  3. Packt Upsell
  4. Contributors
  5. Preface
  6. Keras Installation
  7. Working with Keras Datasets and Models
  8. Data Preprocessing, Optimization, and Visualization
  9. Classification Using Different Keras Layers
  10. Implementing Convolutional Neural Networks
  11. Generative Adversarial Networks
  12. Recurrent Neural Networks
  13. Natural Language Processing Using Keras Models
  14. Text Summarization Using Keras Models
  15. Reinforcement Learning
  16. Other Books You May Enjoy
Normes de citation pour Keras Deep Learning Cookbook

APA 6 Citation

Dua, R., & Ghotra, M. S. (2018). Keras Deep Learning Cookbook (1st ed.). Packt Publishing. Retrieved from https://www.perlego.com/book/835429/keras-deep-learning-cookbook-over-30-recipes-for-implementing-deep-neural-networks-in-python-pdf (Original work published 2018)

Chicago Citation

Dua, Rajdeep, and Manpreet Singh Ghotra. (2018) 2018. Keras Deep Learning Cookbook. 1st ed. Packt Publishing. https://www.perlego.com/book/835429/keras-deep-learning-cookbook-over-30-recipes-for-implementing-deep-neural-networks-in-python-pdf.

Harvard Citation

Dua, R. and Ghotra, M. S. (2018) Keras Deep Learning Cookbook. 1st edn. Packt Publishing. Available at: https://www.perlego.com/book/835429/keras-deep-learning-cookbook-over-30-recipes-for-implementing-deep-neural-networks-in-python-pdf (Accessed: 14 October 2022).

MLA 7 Citation

Dua, Rajdeep, and Manpreet Singh Ghotra. Keras Deep Learning Cookbook. 1st ed. Packt Publishing, 2018. Web. 14 Oct. 2022.