1. Home
  2. Explore
  3. Computer Science
  4. Deep Learning Intro

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Deep Learning Intro

  • 24Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Logistic Regression as a Neural Network

In the lecture, logistic regression is interpreted as a neural network with which structure?

24 questions

  1. 1

    In the lecture, logistic regression is interpreted as a neural network with which structure?

    1. A

      A hidden layer with multiple neurons followed by a sigmoid output

    2. B

      Multiple neurons with a softmax output layer

    3. C

      A single neuron with a linear part (wx + b) and a sigmoid activation

    4. D

      A single neuron with a ReLU activation

    Correct answer
    C

    A single neuron with a linear part (wx + b) and a sigmoid activation

    Explanation

    Logistic regression is interpreted as a single neuron: linear part wx + b followed by sigmoid activation.

  2. 2

    What does the notation ŷ represent in the logistic regression model for cat detection?

    1. A

      The flattened image vector

    2. B

      The ground truth label indicating presence of a cat

    3. C

      The sigmoid of wx + b, representing the probability of a cat

    4. D

      The linear output wx + b before activation

    Correct answer
    C

    The sigmoid of wx + b, representing the probability of a cat

    Explanation

    ŷ = σ(wx + b) is the predicted probability that the image contains a cat.

  3. 3

    What is the shape of the weight vector w in logistic regression when the input image is 64×64×3?

    1. A

      64 × 64 × 3

    2. B

      12288 × 12288

    3. C

      12288 × 1

    4. D

      1 × 12288

    Correct answer
    D

    1 × 12288

    Explanation

    The input x is 12288×1 (flattened), so to produce a scalar ŷ, w must be 1×12288.

  4. 4

    How many parameters (weights and biases) does a logistic regression model have when the input dimension is n?

    1. A

      n weights and n biases

    2. B

      n+1 weights and 1 bias

    3. C

      1 weight and n biases

    4. D

      n weights and 1 bias

    Correct answer
    D

    n weights and 1 bias

    Explanation

    There are n weights (one per input feature) and 1 bias, total n+1 parameters.

  5. 5

    What is the core equation of a neuron as defined in the lecture?

    1. A

      Neuron = sum of weighted inputs plus bias

    2. B

      Neuron = sigmoid of wx + b

    3. C

      Neuron = wx + b

    4. D

      Neuron = linear part + activation function

    Correct answer
    D

    Neuron = linear part + activation function

    Explanation

    A neuron is defined as a linear part (wx + b) followed by an activation function.

  6. 6

    What does the equation 'model = architecture + parameters' mean?

    1. A

      A model consists of a defined architecture (e.g., number of layers and neurons) and the learned parameters (weights and biases)

    2. B

      The architecture determines the parameters, so they are not independent

    3. C

      The architecture is the software and the parameters are the hardware

    4. D

      The model is only the parameters, and the architecture is irrelevant

    Correct answer
    A

    A model consists of a defined architecture (e.g., number of layers and neurons) and the learned parameters (weights and biases)

    Explanation

    Training yields two files: one for architecture and one for parameters; both together constitute the model.

  7. 7

    For a multi-class classification with 3 classes (cat, lion, iguana) using logistic regression neurons, what is the output vector ŷ?

    1. A

      A 3-dimensional vector that sums to 1 due to softmax

    2. B

      A 3-dimensional vector with one element equal to 1 and others 0

    3. C

      A single scalar indicating the most likely class

    4. D

      A 3-dimensional vector, each element being the sigmoid output of a separate neuron

    Correct answer
    D

    A 3-dimensional vector, each element being the sigmoid output of a separate neuron

    Explanation

    With three independent sigmoid neurons, each outputs a probability; the vector ŷ has three elements, each between 0 and 1, but they do not sum to 1.

  8. 8

    How many parameters does a network have with an input of size n, a hidden layer of 3 neurons, and an output layer of 3 neurons (no softmax)?

    1. A

      3n weights and 3 biases, total 3n + 3

    2. B

      n weights and 3 biases, total n + 3

    3. C

      3n + 3 weights and 3 + 3 biases, total 3n + 6

    4. D

      3n + 3 weights and no biases

    Correct answer
    C

    3n + 3 weights and 3 + 3 biases, total 3n + 6

    Explanation

    First layer: 3n weights + 3 biases; second layer: 3×3 = 9 weights + 3 biases; total 3n + 12? Wait, careful: Actually the text says 3n+3 for the first layer (3 neurons, each with n weights and 1 bias) and then for the second layer (3 neurons each with 3 weights and 1 bias) gives 9+3=12 additional, total 3n+15. But the lecture answer: 3n+3? Let's re-check: Actually the lecture says

  9. 9

    What is the purpose of the softmax function in a multi-class neural network?

    1. A

      To ensure that all outputs are between 0 and 1 but not necessarily summing to 1

    2. B

      To apply a sigmoid to each output independently

    3. C

      To reduce the number of output neurons to one

    4. D

      To convert the linear outputs into a probability distribution that sums to 1

    Correct answer
    D

    To convert the linear outputs into a probability distribution that sums to 1

    Explanation

    Softmax exponentiates the Z values and normalizes by the sum, producing a probability distribution over classes.

  10. 10

    Why does using a softmax output layer make the network not robust to an image containing both a cat and a lion?

    1. A

      Because softmax requires a single correct class label

    2. B

      Because softmax prevents the network from learning multiple objects

    3. C

      Because the softmax outputs must sum to 1, so if both are present, the probabilities cannot both be high

    4. D

      Because softmax works only for binary classification

    Correct answer
    C

    Because the softmax outputs must sum to 1, so if both are present, the probabilities cannot both be high

    Explanation

    Softmax forces the outputs to sum to 1, so detecting two animals simultaneously would require two high probabilities, which is impossible.

  11. 11

    What is the loss function used for training a single logistic regression neuron (binary classification)?

    1. A

      L = max(0, 1 - y*ŷ)

    2. B

      L = (y - ŷ)^2

    3. C

      L = -sum(y_k log(ŷ_k)) for k classes

    4. D

      L = -[y log(ŷ) + (1-y) log(1-ŷ)]

    Correct answer
    D

    L = -[y log(ŷ) + (1-y) log(1-ŷ)]

    Explanation

    The logistic loss (binary cross-entropy) is L = -[y log(ŷ) + (1-y) log(1-ŷ)].

  12. 12

    For a regression task (e.g., predicting cat age), what activation function is suggested in the lecture for the output neuron?

    1. A

      Softmax

    2. B

      Tanh

    3. C

      Linear or ReLU

    4. D

      Sigmoid

    Correct answer
    C

    Linear or ReLU

    Explanation

    Sigmoid outputs in [0,1] are not suitable for age; linear or ReLU (non-negative) are suggested.

  13. 13

    What loss function is commonly used for regression tasks?

    1. A

      Hinge loss

    2. B

      Categorical cross-entropy

    3. C

      Binary cross-entropy

    4. D

      Mean squared error (L2 loss)

    Correct answer
    D

    Mean squared error (L2 loss)

    Explanation

    The lecture mentions using (ŷ - y) squared, i.e., L2 loss for regression.

  14. 14

    In the forward propagation for a neural network with one hidden layer of 3 neurons and an output layer of 1 neuron, what is the shape of Z[1]?

    1. A

      3 × m (for m examples)

    2. B

      3 × 1 (for a single input example)

    3. C

      1 × 1

    4. D

      1 × 3

    Correct answer
    B

    3 × 1 (for a single input example)

    Explanation

    Z[1] = W[1]X + b[1]. With 3 neurons and input size n, W[1] is 3×n, X is n×1, so Z[1] is 3×1.

  15. 15

    When processing a batch of m examples, how does the shape of the weight matrices change compared to processing a single example?

    1. A

      Weight matrices become m times larger

    2. B

      Weight matrices remain the same size; only the input X becomes a matrix of shape n×m

    3. C

      Weight matrices become square matrices of size m×m

    4. D

      Weight matrices become transposed

    Correct answer
    B

    Weight matrices remain the same size; only the input X becomes a matrix of shape n×m

    Explanation

    The number of parameters (weights and biases) is independent of the batch size; only the input matrix expands to accommodate m examples.

  16. 16

    What technique allows adding a bias vector of shape (3,1) to a matrix of shape (3,m) in forward propagation?

    1. A

      Transposing the bias

    2. B

      Using a for loop

    3. C

      Looping over examples

    4. D

      Broadcasting

    Correct answer
    D

    Broadcasting

    Explanation

    Broadcasting (in numPy) automatically repeats the bias column m times to make the addition possible.

  17. 17

    Why is the first hidden layer in a cat detector often found to detect edges?

    1. A

      Because edges are the only features useful for cat detection

    2. B

      Because the loss function forces edge detection

    3. C

      Because it receives raw pixels and can only combine nearby pixel values to detect simple patterns like edges

    4. D

      Because the network is pre-trained on edge detection tasks

    Correct answer
    C

    Because it receives raw pixels and can only combine nearby pixel values to detect simple patterns like edges

    Explanation

    First layer neurons only see pixels, so the most complex pattern they can learn is edges (combinations of nearby pixels).

  18. 18

    What distinguishes a hidden layer from the input and output layers?

    1. A

      Hidden layers have fewer neurons than input layers

    2. B

      Hidden layers are only present in deep networks

    3. C

      Hidden layers use different activation functions

    4. D

      Hidden layers do not directly see the input or output; they create abstract representations

    Correct answer
    D

    Hidden layers do not directly see the input or output; they create abstract representations

    Explanation

    Hidden layers are not directly connected to input or output; they receive from previous layer and pass to next, forming abstractions.

  19. 19

    In backward propagation, why do we compute derivatives starting from the output layer?

    1. A

      Because the output layer is closest to the loss function, making derivatives easier to compute via the chain rule

    2. B

      Because the input layer has more parameters

    3. C

      Because the output layer's parameters are more important

    4. D

      Because we need to compute forward propagation first

    Correct answer
    A

    Because the output layer is closest to the loss function, making derivatives easier to compute via the chain rule

    Explanation

    The loss depends directly on the output; derivatives w.r.t. later layers are simpler and can be reused for earlier layers via the chain rule.

  20. 20

    What is the key mathematical tool used in backward propagation to compute gradients?

    1. A

      Matrix inversion

    2. B

      Principal component analysis

    3. C

      The chain rule of calculus

    4. D

      The product rule

    Correct answer
    C

    The chain rule of calculus

    Explanation

    Backpropagation uses the chain rule to decompose the gradient of the loss into manageable parts from output to input.

  21. 21

    What is the difference between loss function L and cost function J when training with a batch of examples?

    1. A

      L is for a single example; J is the average (or sum) of L over the entire batch

    2. B

      L is used in gradient descent; J is used in stochastic gradient descent

    3. C

      L is computed from the output; J is computed from the weights

    4. D

      L is for classification; J is for regression

    Correct answer
    A

    L is for a single example; J is the average (or sum) of L over the entire batch

    Explanation

    Loss L measures error on one example; cost J averages (or sums) L over all examples in the batch.

  22. 22

    In the gradient descent update rule w_l = w_l - α * dJ/dw_l, what does α represent?

    1. A

      The mini-batch size

    2. B

      The regularization parameter

    3. C

      The momentum coefficient

    4. D

      The learning rate, controlling step size

    Correct answer
    D

    The learning rate, controlling step size

    Explanation

    α is the learning rate, a hyperparameter that scales the gradient update.

  23. 23

    What is a common method to determine the number of layers and neurons per layer for a new problem?

    1. A

      Use a fixed rule: number of neurons = number of input features

    2. B

      Use the architecture of a similar published paper without modification

    3. C

      Try several architectures on a validation set and pick the one with best accuracy

    4. D

      Set number of layers equal to the number of classes

    Correct answer
    C

    Try several architectures on a validation set and pick the one with best accuracy

    Explanation

    The lecture suggests experimenting with different architectures and selecting based on validation performance, aided by experience.

  24. 24

    According to the lecture, what factors contributed to the recent success of deep learning?

    1. A

      New computational methods (GPUs), large amounts of data, and algorithmic innovations

    2. B

      Better theoretical understanding alone

    3. C

      Reduction in data requirements

    4. D

      Increased model complexity without computational advances

    Correct answer
    A

    New computational methods (GPUs), large amounts of data, and algorithmic innovations

    Explanation

    The lecture cites computational power (GPUs), data availability, and new algorithms as key enablers.

Question 1 of 24
Question 1 of 24

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent