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)

Calculating Multidimensional Arrays

If you learn how to calculate multidimensional arrays using NumPy, you will be able to implement a neural network efficiently. First, we will look at how to use NumPy to calculate multidimensional arrays. Then, we will implement a neural network.

Multidimensional Arrays

Simply put, a multidimensional array is "a set of numbers" arranged in a line, in a rectangle, in three dimensions, or (more generally) in N dimensions, called a multidimensional array. Let's use NumPy to create a multidimensional array. First, we will create a one-dimensional array, as described so far:

>>> import numpy as np
>>> A = np.array([1, 2, 3, 4])
>>> print(A)
[1 2 3 4]
>>> np.ndim(A)
1
>>> A.shape
(4,)
>>> A.shape[0]
4

As shown here, you can use the np.ndim() function to obtain the number of dimensions of an array. You can also use the instance variable, shape, to obtain the shape of the array...