Lecture Introduction and Logistics
- 15Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
In supervised learning, what constitutes a training set?
In supervised learning, what constitutes a training set?
15 questions
- 1
In supervised learning, what constitutes a training set?
- A
A single pair (x,y)
- B
A set of input examples xi only
- C
A set of input-output pairs (xi,yi)
- D
A set of output labels yi only
Correct answer
CA set of input-output pairs (xi,yi)
Explanation
A training set is defined as a set of pairs (xi,yi), where xi is an input and yi is its corresponding label. This is the foundation for supervised learning.
- A
- 2
What is the role of the hypothesis function h in supervised learning?
- A
To initialize the parameters
- B
To compute the cost function
- C
To map inputs X to outputs Y
- D
To store the training data
Correct answer
CTo map inputs X to outputs Y
Explanation
The hypothesis function h:X→Y is the prediction function that maps input features to output labels. It is the core of the model we learn.
- A
- 3
Which of the following best describes classification?
- A
When Y is a discrete set
- B
When Y is continuous
- C
When the model is linear
- D
When X is a set of images
Correct answer
AWhen Y is a discrete set
Explanation
Classification refers to problems where the output Y is discrete (e.g., cat vs. no cat, handwritten digit).
- A
- 4
What is the purpose of the 'one' feature x0 in linear regression?
- A
Both to convert affine to linear and represent intercept
- B
To represent the intercept term
- C
To convert an affine model into a linear one
- D
To add noise to the model
Correct answer
ABoth to convert affine to linear and represent intercept
Explanation
By setting x0=1 always, the model hθ(x)=θ0x0+θ1x1+⋯+θdxd becomes linear in the parameters, and θ0 acts as the intercept.
- A
- 5
In linear regression, the prediction for input x is hθ(x)=θTx. What does this notation imply?
- A
θ is a scalar
- B
x includes a 1 as the first element
- C
θT denotes transpose of the feature vector
- D
x is a scalar
Correct answer
Bx includes a 1 as the first element
Explanation
For linear regression, we augment x with a 1 (i.e., x0=1) so that θTx=θ0⋅1+θ1x1+⋯+θdxd.
- A
- 6
What is the cost function J(θ) for linear regression (least squares)?
- A
n1∑i=1n(hθ(x(i))−y(i))2
- B
∑i=1n∣hθ(x(i))−y(i)∣
- C
21∑i=1n(hθ(x(i))−y(i))2
- D
∑i=1n(hθ(x(i))−y(i))
Correct answer
C21∑i=1n(hθ(x(i))−y(i))2
Explanation
The cost function is J(θ)=21∑i=1n(hθ(x(i))−y(i))2. The factor 1/2 simplifies the derivative.
- A
- 7
Why is the 1/2 factor included in the least squares cost function?
- A
To ensure convexity
- B
To scale the gradient for faster convergence
- C
To make the derivative cancel the factor of 2 from the square
- D
To normalize the cost by the number of examples
Correct answer
CTo make the derivative cancel the factor of 2 from the square
Explanation
When taking the derivative of the squared term, the 1/2 cancels the 2 that comes from the chain rule, simplifying the gradient expression.
- A
- 8
In gradient descent, what does the update rule θj:=θj−α∂θj∂J(θ) accomplish?
- A
It randomly perturbs θ
- B
It moves θ in the direction of the gradient to maximize J
- C
It sets θ to zero
- D
It moves θ in the direction of the negative gradient to minimize J
Correct answer
DIt moves θ in the direction of the negative gradient to minimize J
Explanation
Gradient descent updates parameters in the opposite direction of the gradient to reduce the cost function. α controls the step size.
- A
- 9
What is the partial derivative of the least squares cost J(θ)=21∑i=1n(hθ(x(i))−y(i))2 with respect to θj?
- A
∑i=1n(hθ(x(i))−y(i))xj(i)
- B
21∑i=1n(hθ(x(i))−y(i))xj(i)
- C
∑i=1n(hθ(x(i))−y(i))
- D
∑i=1n(hθ(x(i))−y(i))(xj(i))2
Correct answer
A∑i=1n(hθ(x(i))−y(i))xj(i)
Explanation
Using chain rule: ∂θj∂J=∑i(hθ(x(i))−y(i))⋅∂θj∂hθ(x(i)). For linear regression, ∂θj∂hθ(x(i))=xj(i), giving the result.
- A
- 10
What distinguishes batch gradient descent from stochastic gradient descent?
- A
Batch uses a subset; stochastic uses all data
- B
Batch is only for linear regression; stochastic is for neural networks
- C
Batch is faster; stochastic is slower per iteration
- D
Batch uses all data per step; stochastic uses one data point per step
Correct answer
DBatch 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.
- A
- 11
What is mini-batch gradient descent?
- A
It uses B examples but processes them sequentially without updating
- B
It uses all examples but in smaller steps
- C
It uses a random subset of B examples per update, where 1<B<n
- D
It uses one example per update
Correct answer
CIt uses a random subset of B examples per update, where 1<B<n
Explanation
Mini-batch gradient descent samples a small batch of B examples (e.g., 128) to estimate the gradient, balancing speed and accuracy.
- A
- 12
What is a potential consequence of setting the learning rate α too large?
- A
The cost function becomes convex
- B
The algorithm may overshoot the minimum and diverge
- C
The gradient becomes zero
- D
The algorithm converges faster and more accurately
Correct answer
BThe algorithm may overshoot the minimum and diverge
Explanation
If α is too large, gradient descent can oscillate or overshoot the minimum, potentially failing to converge.
- A
- 13
What is the normal equation in linear regression?
- A
A closed-form solution for θ that minimizes the cost function
- B
An iterative gradient-based method
- C
A way to compute the gradient efficiently
- D
A method to initialize parameters randomly
Correct answer
AA closed-form solution for θ that minimizes the cost function
Explanation
The normal equation θ=(XTX)−1XTy directly computes the optimal θ without iteration, though it may be expensive for large d.
- A
- 14
Why is it important to plot your data before applying a machine learning model?
- A
To visually inspect patterns and identify potential issues
- B
To compute the cost function
- C
To initialize the parameters
- D
To determine the learning rate
Correct answer
ATo 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.
- A
- 15
What is overfitting in the context of supervised learning?
- A
When the training set is too small
- B
When a model cannot fit the training data well
- C
When a model fits the training data too closely and fails to generalize
- D
When the learning rate is too large
Correct answer
CWhen 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.
- A

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