1. Home
  2. Explore
  3. Other
  4. Lecture Introduction and Logistics

Study methods

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

Lecture Introduction and Logistics

  • 15Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Supervised Learning Basics

In supervised learning, what constitutes a training set?

15 questions

  1. 1

    In supervised learning, what constitutes a training set?

    1. A

      A single pair (x,y)(x, y)(x,y)

    2. B

      A set of input examples xix_ixi​ only

    3. C

      A set of input-output pairs (xi,yi)(x_i, y_i)(xi​,yi​)

    4. D

      A set of output labels yiy_iyi​ only

    Correct answer
    C

    A set of input-output pairs (xi,yi)(x_i, y_i)(xi​,yi​)

    Explanation

    A training set is defined as a set of pairs (xi,yi)(x_i, y_i)(xi​,yi​), where xix_ixi​ is an input and yiy_iyi​ is its corresponding label. This is the foundation for supervised learning.

  2. 2

    What is the role of the hypothesis function hhh in supervised learning?

    1. A

      To initialize the parameters

    2. B

      To compute the cost function

    3. C

      To map inputs XXX to outputs YYY

    4. D

      To store the training data

    Correct answer
    C

    To map inputs XXX to outputs YYY

    Explanation

    The hypothesis function h:X→Yh: X \to Yh:X→Y is the prediction function that maps input features to output labels. It is the core of the model we learn.

  3. 3

    Which of the following best describes classification?

    1. A

      When YYY is a discrete set

    2. B

      When YYY is continuous

    3. C

      When the model is linear

    4. D

      When XXX is a set of images

    Correct answer
    A

    When YYY is a discrete set

    Explanation

    Classification refers to problems where the output YYY is discrete (e.g., cat vs. no cat, handwritten digit).

  4. 4

    What is the purpose of the 'one' feature x0x_0x0​ in linear regression?

    1. A

      Both to convert affine to linear and represent intercept

    2. B

      To represent the intercept term

    3. C

      To convert an affine model into a linear one

    4. D

      To add noise to the model

    Correct answer
    A

    Both to convert affine to linear and represent intercept

    Explanation

    By setting x0=1x_0 = 1x0​=1 always, the model hθ(x)=θ0x0+θ1x1+⋯+θdxdh_\theta(x) = \theta_0 x_0 + \theta_1 x_1 + \dots + \theta_d x_dhθ​(x)=θ0​x0​+θ1​x1​+⋯+θd​xd​ becomes linear in the parameters, and θ0\theta_0θ0​ acts as the intercept.

  5. 5

    In linear regression, the prediction for input xxx is hθ(x)=θTxh_\theta(x) = \theta^T xhθ​(x)=θTx. What does this notation imply?

    1. A

      θ\thetaθ is a scalar

    2. B

      xxx includes a 111 as the first element

    3. C

      θT\theta^TθT denotes transpose of the feature vector

    4. D

      xxx is a scalar

    Correct answer
    B

    xxx includes a 111 as the first element

    Explanation

    For linear regression, we augment xxx with a 111 (i.e., x0=1x_0 = 1x0​=1) so that θTx=θ0⋅1+θ1x1+⋯+θdxd\theta^T x = \theta_0 \cdot 1 + \theta_1 x_1 + \dots + \theta_d x_dθTx=θ0​⋅1+θ1​x1​+⋯+θd​xd​.

  6. 6

    What is the cost function J(θ)J(\theta)J(θ) for linear regression (least squares)?

    1. A

      1n∑i=1n(hθ(x(i))−y(i))2\frac{1}{n} \sum_{i=1}^n (h_\theta(x^{(i)}) - y^{(i)})^2n1​∑i=1n​(hθ​(x(i))−y(i))2

    2. B

      ∑i=1n∣hθ(x(i))−y(i)∣\sum_{i=1}^n |h_\theta(x^{(i)}) - y^{(i)}|∑i=1n​∣hθ​(x(i))−y(i)∣

    3. C

      12∑i=1n(hθ(x(i))−y(i))2\frac{1}{2} \sum_{i=1}^n (h_\theta(x^{(i)}) - y^{(i)})^221​∑i=1n​(hθ​(x(i))−y(i))2

    4. D

      ∑i=1n(hθ(x(i))−y(i))\sum_{i=1}^n (h_\theta(x^{(i)}) - y^{(i)})∑i=1n​(hθ​(x(i))−y(i))

    Correct answer
    C

    12∑i=1n(hθ(x(i))−y(i))2\frac{1}{2} \sum_{i=1}^n (h_\theta(x^{(i)}) - y^{(i)})^221​∑i=1n​(hθ​(x(i))−y(i))2

    Explanation

    The cost function is J(θ)=12∑i=1n(hθ(x(i))−y(i))2J(\theta) = \frac{1}{2} \sum_{i=1}^n (h_\theta(x^{(i)}) - y^{(i)})^2J(θ)=21​∑i=1n​(hθ​(x(i))−y(i))2. The factor 1/21/21/2 simplifies the derivative.

  7. 7

    Why is the 1/21/21/2 factor included in the least squares cost function?

    1. A

      To ensure convexity

    2. B

      To scale the gradient for faster convergence

    3. C

      To make the derivative cancel the factor of 2 from the square

    4. D

      To normalize the cost by the number of examples

    Correct answer
    C

    To make the derivative cancel the factor of 2 from the square

    Explanation

    When taking the derivative of the squared term, the 1/21/21/2 cancels the 222 that comes from the chain rule, simplifying the gradient expression.

  8. 8

    In gradient descent, what does the update rule θj:=θj−α∂∂θjJ(θ)\theta_j := \theta_j - \alpha \frac{\partial}{\partial \theta_j} J(\theta)θj​:=θj​−α∂θj​∂​J(θ) accomplish?

    1. A

      It randomly perturbs θ\thetaθ

    2. B

      It moves θ\thetaθ in the direction of the gradient to maximize JJJ

    3. C

      It sets θ\thetaθ to zero

    4. D

      It moves θ\thetaθ in the direction of the negative gradient to minimize JJJ

    Correct answer
    D

    It moves θ\thetaθ in the direction of the negative gradient to minimize JJJ

    Explanation

    Gradient descent updates parameters in the opposite direction of the gradient to reduce the cost function. α\alphaα controls the step size.

  9. 9

    What is the partial derivative of the least squares cost J(θ)=12∑i=1n(hθ(x(i))−y(i))2J(\theta) = \frac{1}{2} \sum_{i=1}^n (h_\theta(x^{(i)}) - y^{(i)})^2J(θ)=21​∑i=1n​(hθ​(x(i))−y(i))2 with respect to θj\theta_jθj​?

    1. A

      ∑i=1n(hθ(x(i))−y(i)) xj(i)\sum_{i=1}^n (h_\theta(x^{(i)}) - y^{(i)}) \, x_j^{(i)}∑i=1n​(hθ​(x(i))−y(i))xj(i)​

    2. B

      12∑i=1n(hθ(x(i))−y(i)) xj(i)\frac{1}{2} \sum_{i=1}^n (h_\theta(x^{(i)}) - y^{(i)}) \, x_j^{(i)}21​∑i=1n​(hθ​(x(i))−y(i))xj(i)​

    3. C

      ∑i=1n(hθ(x(i))−y(i))\sum_{i=1}^n (h_\theta(x^{(i)}) - y^{(i)})∑i=1n​(hθ​(x(i))−y(i))

    4. D

      ∑i=1n(hθ(x(i))−y(i)) (xj(i))2\sum_{i=1}^n (h_\theta(x^{(i)}) - y^{(i)}) \, (x_j^{(i)})^2∑i=1n​(hθ​(x(i))−y(i))(xj(i)​)2

    Correct answer
    A

    ∑i=1n(hθ(x(i))−y(i)) xj(i)\sum_{i=1}^n (h_\theta(x^{(i)}) - y^{(i)}) \, x_j^{(i)}∑i=1n​(hθ​(x(i))−y(i))xj(i)​

    Explanation

    Using chain rule: ∂∂θjJ=∑i(hθ(x(i))−y(i))⋅∂∂θjhθ(x(i))\frac{\partial}{\partial \theta_j} J = \sum_i (h_\theta(x^{(i)}) - y^{(i)}) \cdot \frac{\partial}{\partial \theta_j} h_\theta(x^{(i)})∂θj​∂​J=∑i​(hθ​(x(i))−y(i))⋅∂θj​∂​hθ​(x(i)). For linear regression, ∂∂θjhθ(x(i))=xj(i)\frac{\partial}{\partial \theta_j} h_\theta(x^{(i)}) = x_j^{(i)}∂θj​∂​hθ​(x(i))=xj(i)​, giving the result.

  10. 10

    What distinguishes batch gradient descent from stochastic gradient descent?

    1. A

      Batch uses a subset; stochastic uses all data

    2. B

      Batch is only for linear regression; stochastic is for neural networks

    3. C

      Batch is faster; stochastic is slower per iteration

    4. D

      Batch uses all data per step; stochastic uses one data point per step

    Correct answer
    D

    Batch uses all data per step; stochastic uses one data point per step

    Explanation

    Batch gradient descent computes the gradient over the entire training set before updating, while stochastic gradient descent updates using a single randomly chosen example.

  11. 11

    What is mini-batch gradient descent?

    1. A

      It uses BBB examples but processes them sequentially without updating

    2. B

      It uses all examples but in smaller steps

    3. C

      It uses a random subset of BBB examples per update, where 1<B<n1 < B < n1<B<n

    4. D

      It uses one example per update

    Correct answer
    C

    It uses a random subset of BBB examples per update, where 1<B<n1 < B < n1<B<n

    Explanation

    Mini-batch gradient descent samples a small batch of BBB examples (e.g., 128) to estimate the gradient, balancing speed and accuracy.

  12. 12

    What is a potential consequence of setting the learning rate α\alphaα too large?

    1. A

      The cost function becomes convex

    2. B

      The algorithm may overshoot the minimum and diverge

    3. C

      The gradient becomes zero

    4. D

      The algorithm converges faster and more accurately

    Correct answer
    B

    The algorithm may overshoot the minimum and diverge

    Explanation

    If α\alphaα is too large, gradient descent can oscillate or overshoot the minimum, potentially failing to converge.

  13. 13

    What is the normal equation in linear regression?

    1. A

      A closed-form solution for θ\thetaθ that minimizes the cost function

    2. B

      An iterative gradient-based method

    3. C

      A way to compute the gradient efficiently

    4. D

      A method to initialize parameters randomly

    Correct answer
    A

    A closed-form solution for θ\thetaθ that minimizes the cost function

    Explanation

    The normal equation θ=(XTX)−1XTy\theta = (X^T X)^{-1} X^T yθ=(XTX)−1XTy directly computes the optimal θ\thetaθ without iteration, though it may be expensive for large ddd.

  14. 14

    Why is it important to plot your data before applying a machine learning model?

    1. A

      To visually inspect patterns and identify potential issues

    2. B

      To compute the cost function

    3. C

      To initialize the parameters

    4. D

      To determine the learning rate

    Correct answer
    A

    To visually inspect patterns and identify potential issues

    Explanation

    Plotting data helps understand relationships, detect outliers, and ensure the model assumptions are reasonable. The lecture emphasized this as a crucial first step.

  15. 15

    What is overfitting in the context of supervised learning?

    1. A

      When the training set is too small

    2. B

      When a model cannot fit the training data well

    3. C

      When a model fits the training data too closely and fails to generalize

    4. D

      When the learning rate is too large

    Correct answer
    C

    When a model fits the training data too closely and fails to generalize

    Explanation

    Overfitting occurs when a model learns noise in the training data, resulting in poor performance on unseen data. The lecture mentions this trade-off.

Question 1 of 15
Question 1 of 15

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent