본문 바로가기

Coursera/Deep Learning Specialization

Neural Networks and Deep Learning (4)

728x90

Neural Networks Basics

Python and Vectorization

728x90

Vectorization

Vectorization is how to apply a function in parallel across all examples simultaneously.

In Python, vectorization avoids using the for-loop and reduces the computation and time.

 

True or false. Vectorization cannot be done without a GPU.

더보기

False

More Vectorization Examples

012

We can apply any function to matrices or vectors.

In our example, we are applying an exponential function to the values.

Vectorizing Logistic Regression

We are performing matrix multiplication using the transposed weight matrix (W) with the input data (X) and adding a bias vector (b) which speeds up the computation.

Then we apply a sigmoid function to our column output vector (Z) to get our predicted probability vector (A).

 

What are the dimensions of matrix X in this video?

더보기

$(n_x, m)$

Vectorizing Logistic Regression’s Gradient Output

01

How do you compute the derivative of b in one line of code in Python numpy?

더보기

1 / m * (np.sum(dZ))

Broadcasting in Python

012

Broadcasting aids computation without the need to use the explicit for-loops.

Broadcasting acts like an extended element-wise matrix multiplication.

 

What numpy lines of code would sum the values in a matrix A vertically?

더보기

A.sum(axis=0)

A Note on Python/Numpy Vectors

One rule of thumb is to avoid using the rank 1 array as it can cause bugs later when performing matrix multiplication.

 

What kind of array has dimensions in this format: (10, )?

더보기

A rank 1 array

Explanation of Logistic Regression Cost Function

01

True or False: Minimizing the loss corresponds with maximizing log p(y|x).

더보기

True

All the information provided is based on the Deep Learning Specialization | Coursera from DeepLearning.AI

728x90