• Complain

Rajdeep Dua - Keras Deep Learning Cookbook: Over 80 Recipes for Implementing Deep Neural Networks in Python

Here you can read online Rajdeep Dua - Keras Deep Learning Cookbook: Over 80 Recipes for Implementing Deep Neural Networks in Python full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2018, publisher: Packt Publishing, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Rajdeep Dua Keras Deep Learning Cookbook: Over 80 Recipes for Implementing Deep Neural Networks in Python
  • Book:
    Keras Deep Learning Cookbook: Over 80 Recipes for Implementing Deep Neural Networks in Python
  • Author:
  • Publisher:
    Packt Publishing
  • Genre:
  • Year:
    2018
  • Rating:
    4 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 80
    • 1
    • 2
    • 3
    • 4
    • 5

Keras Deep Learning Cookbook: Over 80 Recipes for Implementing Deep Neural Networks in Python: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Keras Deep Learning Cookbook: Over 80 Recipes for Implementing Deep Neural Networks in Python" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Leverage the power of deep learning and Keras to solve complex computational problems

Key Features
  • Recipes on training and fine-tuning your neural network models efficiently using Keras
  • A highly practical guide to simplify your understanding of neural networks and their implementation
  • This book is a must-have on your shelf if you are planning to put your deep learning knowledge to practical use
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.

This book shows you how to tackle different problems in training efficient deep learning models using the popular Keras library. Starting with installing and setting up of Keras, the book demonstrates how you can perform deep learning with Keras on top of Tensorflow, Apache MXNet and CNTK backends. From loading the data to fitting and evaluating your model for optimal performance, you will go through a step by step process to tackle every possible problem in training deep models. You will implement efficient convolutional neural networks, recurrent neural networks, adversarial networks and more, with the help of this handy guide. You will also see 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 on top of Tensorflow, Apache MXNet and CNTK
  • Develop a strong background in neural network programming using the Keras library
  • Understand the details of different Keras layers like Core, Embedding and so on
  • Use Keras to implement simple feed-forward neural networks and the more complex CNNs, RNNs
  • Work with various datasets, models used for image and text classification
  • Develop text summarization and Reinforcement Learning models using Keras
Who This Book Is For

Data scientists and machine learning experts looking to find practical solutions to the common problems encountered while training deep learning models will find this book to be a useful resource. A basic understanding of Python, as well as some experience with machine learning and neural networks is required for this book.

**

About the Author

Rajdeep Dua has over 18 years of experience in the Cloud and Big Data space. He worked in the advocacy team for Googles big data tools, BigQuery. He worked on the Greenplum big data platform at VMware in the developer evangelist team. He also worked closely with a team on porting Spark to run on VMwares public and private cloud as a feature set. He has taught Spark and Big Data at some of the most prestigious tech schools in India: IIIT Hyderabad, ISB, IIIT Delhi, and College of Engineering Pune.

Currently, he leads the developer relations team at Salesforce India. He also works with the data pipeline team at Salesforce, which uses Hadoop and Spark to expose big data processing tools for developers.

He has published Big Data and Spark tutorials. He has also presented BigQuery and Google App Engine at the W3C conference in Hyderabad. He led the developer relations teams at Google, VMware, and Microsoft, and he has spoken at hundreds of other conferences on the cloud. Some of the other references to his work can be seen at Your Story and on ACM digital library.

His contributions to the open source community are related to Docker, Kubernetes, Android, OpenStack, and cloud foundry. You can connect with him on LinkedIn.

Manpreet Singh Ghotra has more than 15 years of experience in software development for both enterprise and big data software. He is currently working on developing a machine learning platform/apis using open source libraries and frameworks like Keras, Apache Spark, Tensorflow at Salesforce. He has worked on various machine learning systems like sentiment analysis, spam detection and anomaly detection. He was part of the machine learning group at one of the largest online retailers in the world, working on transit time calculations using Apache Mahout and the R Recommendation system using Apache Mahout. With a masters and postgraduate degree in machine learning, he has contributed to and worked for the machine learning community.

Rajdeep Dua: author's other books


Who wrote Keras Deep Learning Cookbook: Over 80 Recipes for Implementing Deep Neural Networks in Python? Find out the surname, the name of the author of the book and a list of all author's works by series.

Keras Deep Learning Cookbook: Over 80 Recipes for Implementing Deep Neural Networks in Python — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Keras Deep Learning Cookbook: Over 80 Recipes for Implementing Deep Neural Networks in Python" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Summary

Generative models are a fast advancing area of study and research. As we proceed to advance these models and grow the training and datasets, we can expect to generate data examples that depict completely believable images, finally. This can be used in several applications such as image denoising, painting, structured prediction, and exploration in reinforcement learning.

The deeper promise of this effort is that, in the process of building generative models, we will enrich the computer with an understanding of the world and what elements it is made up of.

Sequence models

If the data is temporal in nature, then we can use specialized algorithms called Sequence Models. These models can learn the probability of the form p(y|x_n, x_1), where i is an index signifying the location in the sequence and x_i is the ith input sample.

As an example, we can consider each word as a series of characters, each sentence as a series of words, and each paragraph as a series of sentences. Output y could be the sentiment of the sentence.

Using a similar trick from autoencoders, we can replace y with the next item in the series or sequence, namely y =x_n + 1, allowing the model to learn.

Example code

The following code demonstrates max pooling on a tensor using a VALID padding scheme:

import tensorflow as tf
batch_size=1
input_height = 3
input_width = 3
input_channels = 1
def main():
sess = tf.InteractiveSession()
layer_input = tf.constant([
[
[[1.0], [0.2], [2.0]],
[[0.1], [1.2], [1.4]],
[[1.1], [0.4], [0.4]]
]
])
# The strides will look at the entire input by using the image_height and image_width
kernel = [batch_size, input_height, input_width, input_channels]
max_pool = tf.nn.max_pool(layer_input, kernel, [1, 1, 1, 1], "VALID")
print(sess.run(max_pool))
if __name__ == '__main__':
main()

The output of the preceding listing will give the maximum values in the window 3 x 3 x 1:

[[[[ 2.]]]]

The following diagram explains how max pool logic works:

As can be seen max pool selected the maximum value from the window based on a - photo 1

As can be seen, max pool selected the maximum value from the window based on a stride of 1, 1, 1.

Convolution on an image

If we use a 2D image I as our input, we probably also want to use a 2D kernel K. The preceding equation will look as follows:

As the convolution function is commutative we can write the preceding equation - photo 2

As the convolution function is commutative, we can write the preceding equation as follows:

Changing i - m and j -n to additions is referred to as cross-correlation as - photo 3

Changing i - m and j -n to additions is referred to as cross-correlation, as that is what is implemented by TensorFlow:

Lets define a simple input and a kernel and run the conv2d operation in - photo 4

Let's define a simple input and a kernel and run the conv2d operation in TensorFlow. Let's take a look at a simple image input and a kernel input. The following diagram shows a basic image, a kernel, and the expected output by applying the convolution operation:

Example of basic image and kernel applied to it Now lets look at how the - photo 5
Example of basic image and kernel applied to it

Now let's look at how the output is achieved with a stride of 1, 1, 1, 1:

Calculating output by applying kernel to the input Next we will implement the - photo 6
Calculating output by applying kernel to the input

Next, we will implement the same in TensorFlow:

i = tf.constant([
[1.0, 1.0, 1.0, 0.0, 0.0],
[0.0, 0.0, 1.0, 1.0, 1.0],
[0.0, 0.0, 1.0, 1.0, 0.0],
[0.0, 0.0, 1.0, 0.0, 0.0]], dtype=tf.float32)
k = tf.constant([
[1.0, 0.0, 1.0],
[0.0, 1.0, 0.0],
[1.0, 0.0, 1.0]
], dtype=tf.float32),
kernel = tf.reshape(k, [3, 3, 1, 1], name='kernel')
image = tf.reshape(i, [1, 4, 5, 1], name='image')
res = tf.squeeze(tf.nn.conv2d(image, kernel, strides=[1, 1, 1, 1], padding="VALID"))
# VALID means no padding
with tf.Session() as sess:
print sess.run(res)

The output of the preceding listing is as follows--this is the same as the one we calculated manually:

[[ 3. 3. 3.]
[ 2. 2. 4.]]
Analyzing the Iris dataset

Let's look at a feedforward example using the Iris dataset.

You can download the dataset from https://github.com/ml-resources/neuralnetwork-programming/blob/ed1/ch02/iris/iris.csv and the target labels from https://github.com/ml-resources/neuralnetwork-programming/blob/ed1/ch02/iris/target.csv.

In the Iris dataset, we will use 150 rows of data made up of 50 samples from each of three Iris species: Iris setosa, Iris virginica, and Iris versicolor.

Petal geometry compared from three iris species:
Iris Setosa, Iris Virginica, and Iris Versicolor.

In the dataset each row contains data for each flower sample sepal length - photo 7

In the dataset, each row contains data for each flower sample: sepal length, sepal width, petal length, petal width, and flower species. Flower species are stored as integers, with 0 denoting Iris setosa, 1 denoting Iris versicolor, and 2 denoting Iris virginica.

First, we will create a run() function that takes three parameters--hidden layer size h_size, standard deviation for weights stddev, and Step size of Stochastic Gradient Descent sgd_step:

def run(h_size, stddev, sgd_step)

Input data loading is done using the genfromtxt function in numpy. The Iris data loaded has a shape of L: 150 and W: 4. Data is loaded in the all_X variable. Target labels are loaded from target.csv in all_Y with the shape of L: 150, W:3:

def load_iris_data():
from numpy import genfromtxt
data = genfromtxt('iris.csv', delimiter=',')
target = genfromtxt('target.csv', delimiter=',').astype(int)
# Prepend the column of 1s for bias
L, W = data.shape
all_X = np.ones((L, W + 1))
all_X[:, 1:] = data
num_labels = len(np.unique(target))
all_y = np.eye(num_labels)[target]
return train_test_split(all_X, all_y, test_size=0.33, random_state=RANDOMSEED)

Once data is loaded, we initialize the weights matrix based on x_size, y_size, and h_size with standard deviation passed to the run() method:

  • x_size= 5
  • y_size= 3
  • h_size= 128 (or any other number chosen for neurons in the hidden layer)
# Size of Layers
x_size = train_x.shape[1] # Input nodes: 4 features and 1 bias
y_size = train_y.shape[1] # Outcomes (3 iris flowers)
# variables
X = tf.placeholder("float", shape=[None, x_size])
y = tf.placeholder("float", shape=[None, y_size])
weights_1 = initialize_weights((x_size, h_size), stddev)
weights_2 = initialize_weights((h_size, y_size), stddev)

Next, we make the prediction using sigmoid as the activation function defined in the forward_propagration() function:

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Keras Deep Learning Cookbook: Over 80 Recipes for Implementing Deep Neural Networks in Python»

Look at similar books to Keras Deep Learning Cookbook: Over 80 Recipes for Implementing Deep Neural Networks in Python. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Keras Deep Learning Cookbook: Over 80 Recipes for Implementing Deep Neural Networks in Python»

Discussion, reviews of the book Keras Deep Learning Cookbook: Over 80 Recipes for Implementing Deep Neural Networks in Python and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.