Deep Learning Intro
- 36Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
- spaceFlip card
- KI knew it
- DI didn't know it
- ←Previous card
- →Next card
What is logistic regression?
A classification algorithm that outputs a probability between 0 and 1 using the sigmoid function.
Or swipe the card
36 cards
What is logistic regression?
A classification algorithm that outputs a probability between 0 and 1 using the sigmoid function.
How can logistic regression be interpreted as a neural network?
As a single neuron with a sigmoid activation function.
What are the parameters of a logistic regression model?
Weight vector w and bias scalar b.
How many parameters does a logistic regression model have for an input of size n?
n weights + 1 bias = n+1 parameters.
What is the loss function used for logistic regression?
Binary cross-entropy loss: L(y,y^)=−[ylogy^+(1−y)log(1−y^)].
How is logistic regression trained?
By minimizing the loss function using gradient descent, iteratively updating parameters.
How are images represented as input to logistic regression?
The image is flattened into a 1D vector of pixel values (e.g., for 64×64 RGB image: 64×64×3 = 12288 numbers).
What are the shapes of x, w, and y-hat in logistic regression for a single image?
x: (n, 1); w: (1, n); y-hat: scalar (between 0 and 1).
What is the derivative of the sigmoid function?
σ′(z)=σ(z)(1−σ(z)).
How do you extend logistic regression to classify three categories (cat, lion, iguana) without mutual exclusivity?
Use three separate neurons, each with its own weights and bias, and sigmoid activation.
How many parameters does a three-neuron multi-class logistic regression have for input size n?
3n + 3 parameters (3 weight vectors of size 1×n and 3 biases).
What label vector should be used for a cat image in a three-class cat/lion/iguana classifier (without softmax)?
y = [1, 0, 0] representing cat present, lion absent, iguana absent.
What is the loss function for a multi-class logistic regression with independent sigmoid outputs?
Sum of binary cross-entropy losses for each neuron: L=−∑i=13[yilogy^i+(1−yi)log(1−y^i)].
When is softmax regression used instead of independent sigmoids?
When classes are mutually exclusive (only one class present at a time).
What is the softmax function for three classes?
y^i=∑j=13ezjezi for i=1,2,3.
What is the loss function for softmax regression?
Categorical cross-entropy loss: L=−∑i=1Cyilogy^i.
Why is the derivative more complex for softmax than for independent sigmoids?
Because each output depends on all parameters (due to denominator), so gradients are coupled across classes.
How many parameters does a three-class softmax regression have (input size n)?
3n + 3 (same as independent sigmoid version).
What is a neuron in a neural network?
A computation unit consisting of a linear part z=wTx+b followed by an activation function a=g(z).
What does the phrase 'model = architecture + parameters' mean?
A neural network model consists of a fixed architecture (number of layers, neurons per layer, connections) and learned parameters (weights and biases).
What is a layer in a neural network?
A group of neurons that are not connected to each other within the group.
What are input, hidden, and output layers?
Input layer: first layer that receives raw data. Hidden layer(s): layers between input and output. Output layer: last layer that produces predictions.
Why is a hidden layer called 'hidden'?
Because it does not directly see the inputs or outputs; its inputs come from previous layer and outputs go to next layer.
How do you count the number of parameters in a fully connected neural network?
For each layer l, number of weights = n[l] * n[l-1], number of biases = n[l], where n[l] is number of neurons in layer l. Sum over all layers.
What is a fully connected (dense) layer?
A layer where every neuron in the previous layer is connected to every neuron in the current layer.
Why are deeper neural networks (more layers) useful?
They can learn hierarchical features: early layers detect simple patterns (edges), middle layers combine into parts (ears, eyes), later layers recognize objects (face).
What is end-to-end learning?
A paradigm where a neural network learns a mapping directly from raw input to output without hand-engineered intermediate representations.
Write the forward propagation equations for a 3-layer neural network (input, hidden, output).
Z[1]=W[1]X+b[1], A[1]=g[1](Z[1]), Z[2]=W[2]A[1]+b[2], A[2]=g[2](Z[2]), Z[3]=W[3]A[2]+b[3], A[3]=g[3](Z[3]).
What are the shapes of Z[1], W[1], X, and b[1] for a batch of m examples with input size n and first layer size 3?
Z[1]: (3,m); W[1]: (3,n); X: (n,m); b[1]: (3,1).
What is broadcasting in the context of neural network computations?
Automatically replicating a smaller matrix (e.g., bias vector) to match the dimensions of a larger matrix during element-wise operations.
Why use batch gradient descent instead of stochastic gradient descent?
Batch gradient descent gives a more accurate gradient direction by averaging over all examples, leading to smoother convergence.
What is the difference between loss function and cost function in neural networks?
Loss function measures error on a single example; cost function is average loss over the entire batch (e.g., J=m1∑i=1mL(i)).
What is backpropagation?
A method to compute gradients of the cost function with respect to all parameters using the chain rule, propagating errors from output layer backwards.
Why does backpropagation start from the last layer?
Because the last layer is closest to the cost function, making the derivative easier to compute. The chain rule then propagates gradients backward.
How do you compute the gradient of cost with respect to W[3] (output layer weights) using chain rule?
∂W[3]∂J=∂A[3]∂J⋅∂Z[3]∂A[3]⋅∂W[3]∂Z[3].
What is the pattern for computing ∂Z[l]∂J for layer l using backpropagation?
∂Z[l]∂J=∂Z[l+1]∂J⋅W[l+1]T⊙g[l]′(Z[l]).

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