Book Image

Deep Learning from the Basics

By : Koki Saitoh
5 (1)
Book Image

Deep Learning from the Basics

5 (1)
By: Koki Saitoh

Overview of this book

Deep learning is rapidly becoming the most preferred way of solving data problems. This is thanks, in part, to its huge variety of mathematical algorithms and their ability to find patterns that are otherwise invisible to us. Deep Learning from the Basics begins with a fast-paced introduction to deep learning with Python, its definition, characteristics, and applications. You’ll learn how to use the Python interpreter and the script files in your applications, and utilize NumPy and Matplotlib in your deep learning models. As you progress through the book, you’ll discover backpropagation—an efficient way to calculate the gradients of weight parameters—and study multilayer perceptrons and their limitations, before, finally, implementing a three-layer neural network and calculating multidimensional arrays. By the end of the book, you’ll have the knowledge to apply the relevant technologies in deep learning.
Table of Contents (11 chapters)

Implementing the Convolution and Pooling Layers

So far, we have seen convolution and pooling layers in detail. In this section, we will implement these two layers in Python. As described in Chapter 5, Backpropagation, the class that will be implemented here also provides forward and backward methods so that it can be used as a module.

You may feel that implementing convolution and pooling layers is complicated, but you can implement them easily if you use a certain "trick." This section describes this trick and makes the task at hand easy. Then, we will implement a convolution layer.

Four-Dimensional Arrays

As described earlier, four-dimensional data flows in each layer in a CNN. For example, when the shape of the data is (10, 1, 28, 28), it indicates that ten pieces of data with a height of 28, width of 28, and 1 channel exist. You can implement this in Python as follows:

>>> x = np.random.rand(10, 1, 28, 28) # Generate data randomly
>>&gt...