Deep Learning Lecture 2
- 30Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
- spaceFlip card
- KI knew it
- DI didn't know it
- ←Previous card
- →Next card
How is logistic regression viewed from a neural network perspective?
Logistic regression can be viewed as a one-neuron neural network with a linear part z=wTx+b and a sigmoid activation function a=σ(z).
Or swipe the card
30 cards
How is logistic regression viewed from a neural network perspective?
Logistic regression can be viewed as a one-neuron neural network with a linear part z=wTx+b and a sigmoid activation function a=σ(z).
What is the range of the sigmoid activation function and why is it used for classification?
The sigmoid function outputs values between 0 and 1, which can be interpreted as probabilities. It is commonly used for binary classification tasks.
Why does stacking more layers in a neural network increase its flexibility?
Stacking layers increases the number of parameters, allowing the network to model more complex functions and better fit the training data.
What is the forward propagation process in a neural network?
Forward propagation computes the output of the network by passing input data through each layer, applying linear transformations z[l]=W[l]a[l−1]+b[l] and activation functions a[l]=g[l](z[l]) sequentially until the final output y^.
How is the cost function J defined in terms of the loss functions for a batch of m examples?
J=m1∑i=1mL(y(i),y^(i))
Write the formula for the binary cross-entropy loss function for a single example.
L(y,y^)=−[ylog(y^)+(1−y)log(1−y^)]
Why is backpropagation performed starting from the last layer?
Because the derivative of the cost with respect to parameters in later layers is easier to compute directly, and the chain rule allows errors to propagate backward from the output to earlier layers.
What is the derivative of the sigmoid function σ(z) with respect to z?
σ′(z)=σ(z)(1−σ(z))
In backpropagation for a neural network with sigmoid output, write the expression for ∂z[3]∂L where L is the binary cross-entropy loss and a[3]=σ(z[3]).
∂z[3]∂L=a[3]−y
Why is caching forward propagation values important during backpropagation?
Caching avoids recomputing intermediate values (e.g., z[l], a[l], W[l]) during backward propagation, improving computational efficiency at the cost of memory.
When computing derivatives in backpropagation, why is shape analysis important?
Shape analysis ensures that the dimensions of matrices and vectors match during gradient calculations, avoiding errors and verifying correctness of derivative expressions.
In backpropagation, why does the derivative of an element-wise activation function (e.g., sigmoid) result in an element-wise product?
Because the activation function is applied element-wise, its derivative is also element-wise, and when the chain rule is applied, gradients are multiplied element-wise (denoted ⊙).
List the formulas and ranges for the three common activation functions: sigmoid, ReLU, and tanh.
Sigmoid: σ(z)=1+e−z1, output in (0,1); ReLU: ReLU(z)=max(0,z), output in [0,∞); tanh: tanh(z)=ez+e−zez−e−z, output in (−1,1).
What is the derivative of the tanh activation function?
tanh′(z)=1−tanh2(z)
What is the derivative of the ReLU activation function?
ReLU′(z)={10if z>0if z≤0
Why does ReLU help mitigate the vanishing gradient problem?
ReLU has a constant gradient of 1 for positive inputs, so gradients do not shrink even for large activations, unlike sigmoid/tanh where gradients approach zero for large ∣z∣.
What happens if a neural network uses only linear activation functions (identity) in all layers?
The entire network becomes equivalent to a single linear transformation (linear regression), losing the ability to learn non-linear relationships regardless of depth.
How does input normalization help in training neural networks?
Normalization (subtracting mean and dividing by standard deviation) centers the data and scales it to unit variance, making the loss function contours more spherical and allowing gradient descent to converge faster.
How should the normalization parameters (mean and variance) be applied to the test set?
The mean and variance computed from the training set should be used to normalize the test set, not recomputed from the test set itself.
What is the weight initialization method recommended for layers with sigmoid activation?
Initialize weights using W[l]=np.random.randn(shape)×n[l−1]1, where n[l−1] is the number of units in the previous layer.
What is the He initialization for layers with ReLU activation?
Initialize weights using W[l]=np.random.randn(shape)×n[l−1]2.
What is the intuition behind Xavier (Glorot) initialization?
Xavier initialization uses n[l−1]+n[l]2 to balance the variance of activations and gradients both during forward and backward propagation.
Why is it important to initialize weights randomly rather than to zero?
Initializing all weights to zero leads to symmetry: all neurons in a layer compute the same activations and gradients, preventing them from learning different features.
What is mini-batch gradient descent and how does it balance batch and stochastic gradient descent?
Mini-batch gradient descent splits the training set into small batches (e.g., 1000 examples) and performs an update using each batch. It exploits vectorization (like batch GD) while having faster updates (like SGD) and less noise.
How does the cost function plot differ between batch gradient descent and mini-batch gradient descent?
Batch gradient descent produces a smooth decreasing curve, while mini-batch gradient descent shows a noisy but generally decreasing trend due to gradient approximations.
Write the update rules for momentum gradient descent.
vdW=βvdW+(1−β)dW; W=W−αvdW (similarly for b).
What is the intuition behind the momentum algorithm?
Momentum averages past gradients, so in directions where gradients oscillate (e.g., vertical), the average is small, and in consistent directions (e.g., horizontal), the average is large, leading to faster convergence.
What is the vanishing gradients problem in deep neural networks?
During backpropagation, gradients become extremely small as they are multiplied by many weight matrices, especially if weights are less than 1, causing early layers to learn very slowly.
What is the exploding gradients problem?
Gradients become very large due to multiplication by weight matrices with values greater than 1, leading to unstable updates and divergence.
How does scaling of weight matrices affect forward propagation in deep linear networks?
If weights are slightly larger than identity (e.g., 1.5), activations explode; if smaller (e.g., 0.5), activations vanish. This multiplicative effect causes vanishing/exploding gradients in deep networks.

Ask anything
We've read this whole study set, so questions about it get the best answers.