Module quiz

ML foundations quiz

25 questions across 2 lessons. Choose an answer, check it, and read why each option is right or wrong.

Checking answers needs JavaScript. You can still read every question and option below.

0 of 25 answered

Keyboard: arrow keys move between options. Space or Enter selects the focused option.

The learning problem: generalization, bias-variance and regularization12 questions

ObjectiveFrame a task as supervised learning, and explain why we minimise empirical risk on training data as a stand-in for expected risk on unseen data.

  1. Question 1 of 25A model is trained by minimising the average loss on the training set. What is that quantity a stand-in for?

    Choose one answer.

  2. Question 2 of 25Which of these tasks is supervised learning?

    Choose one answer.

  3. Question 3 of 25During training, loss on the training set keeps falling for 50 epochs, but loss on the validation set bottoms out at epoch 10 and then rises. A teammate says the model is still improving. What is the best reply?

    Choose one answer.

ObjectiveState the job of the train, validation and test sets, and name the leaks that make a reported score too optimistic.

  1. Question 4 of 25You compared 200 model configurations on the same validation set, and the best one scores 0.92 there. What should you expect on a fresh test set?

    Choose one answer.

  2. Question 5 of 25Which of these are data leaks that make a validation score look better than production performance? Select all that apply.

    Choose all that apply.

  3. Question 6 of 25You have 400 labelled rows. Splitting 70/15/15 leaves only about 60 rows for validation and the scores swing a lot between random splits. What is the most sensible change?

    Choose one answer.

ObjectiveDiagnose high bias or high variance from train and validation error and from learning curves, and pick the fix that matches.

  1. Question 7 of 25A model has training MSE 0.30 and validation MSE 0.29, while the estimated label-noise variance is 0.09. What do you conclude?

    Choose one answer.

  2. Question 8 of 25Training accuracy is 99% and validation accuracy is 80%. After checking for leakage and a mismatched validation set, which actions fit a high-variance diagnosis? Select all that apply.

    Choose all that apply.

  3. Question 9 of 25A straight-line model's train and validation curves have both flattened at about the same high error, about 0.3 against a noise floor of 0.09, as the training set grows from 15 to 60 rows. A manager asks you to buy ten times more labelled data. What do you say?

    Choose one answer.

ObjectiveExplain how an L2 or L1 penalty changes the fitted weights, why only L1 gives exact zeros, and how the strength lambda trades variance for bias.

  1. Question 10 of 25On the lesson's data (x = 1, 2, 3 and y = 2, 4, 5, with sum of xy 25 and sum of x squared 14), what weight does the lasso loss give at lambda = 30?

    Choose one answer.

  2. Question 11 of 25You standardize features and fit lasso and ridge on 200 features, most of them irrelevant. What is the typical difference in the fitted weights?

    Choose one answer.

  3. Question 12 of 25Ridge is fitted to the degree-12 polynomial at four lambdas. (lambda, train MSE, validation MSE): (0.01, 0.049, 0.326), (0.1, 0.062, 0.181), (1, 0.192, 0.220), (10, 0.522, 0.506). Which lambda do you pick, and why?

    Choose one answer.

Linear models, loss functions and gradient descent13 questions

ObjectiveDerive the gradient (p - y) x of the log loss for logistic regression, and explain why cross-entropy rather than squared error is paired with a sigmoid.

  1. Question 13 of 25A logistic regression predicts p = 0.9 for a training example whose true label is y = 0 and whose features are x = [2, -1]. What is the log-loss gradient with respect to the weights for this one example?

    Choose one answer.

  2. Question 14 of 25A teammate trains a binary classifier by passing the sigmoid output through mean squared error instead of log loss. Early in training many examples are confidently wrong (p near 0 when y = 1). What do you expect to see?

    Choose one answer.

  3. Question 15 of 25Which of these statements about logistic regression are true? Select all that apply.

    Choose all that apply.

ObjectiveSolve linear regression with the normal equation and with gradient descent, and say when each is the right tool and what collinear features do.

  1. Question 16 of 25You want a linear regression on 5 million rows and 200,000 sparse bag-of-words features. A colleague proposes the normal equation because it is exact and needs no learning rate. What is the best response?

    Choose one answer.

  2. Question 17 of 25Two features describe a home: x1 is floor area and x2 is living area, about 0.9 times x1 plus a little noise. Three fits on fresh samples of 50 homes give (x1, x2) coefficients of (3.36, -0.39), (4.28, -1.39) and (2.91, 0.13), yet predictions at x1 = 100, x2 = 90 are 300.3, 300.6 and 299.0. What explains this?

    Choose one answer.

  3. Question 18 of 25Fit y = b + w x by least squares to the points x = [1, 2, 3, 4] and y = [1, 3, 2, 4]. Here the sums are sum x = 10, sum x^2 = 30, sum y = 10 and sum xy = 29. What is the slope w?

    Choose one answer.

ObjectiveChoose a loss for a task (squared error, absolute error, Huber, cross-entropy, hinge) by what it penalises, and predict how each reacts to an outlier or a confident mistake.

  1. Question 19 of 25A lender needs an estimated probability of default for each applicant, so it can set a decision threshold from the cost of a bad loan. A data scientist proposes training a linear classifier with hinge loss because it gives a clean margin. What is the problem?

    Choose one answer.

  2. Question 20 of 25You must report one typical value for the daily order counts [10, 12, 11, 13, 500], where 500 is a real but rare promotion day. Which pair gives the value that minimises squared error and the value that minimises absolute error?

    Choose one answer.

  3. Question 21 of 25Which statements about Huber loss are true? Select all that apply.

    Choose all that apply.

ObjectiveExplain how the learning rate, batch size, momentum, Adam and feature scaling change a gradient descent run, and diagnose a run that diverges, crawls or oscillates.

  1. Question 22 of 25You train linear regression with gradient descent on a table with house area in square feet (about 1,000 to 4,000) and number of bedrooms (1 to 5). The loss goes 0.7, 0.4, 3.1, 40, 5,000, then NaN. Which response addresses the cause?

    Choose one answer.

  2. Question 23 of 25Adam is run at learning rate 0.001 on two parameters. On the first step one gradient is 0.002 and the other is 200. About how far does each parameter move?

    Choose one answer.

  3. Question 24 of 25A teammate has tuned plain gradient descent on a narrow valley (best: 79 steps at learning rate 0.45). They add momentum with beta 0.9 and expect faster convergence. In the lesson's grid, beta 0.9 took 122 to 290 steps. What conclusion fits?

    Choose one answer.

  4. Question 25 of 25A mini-batch run with a constant learning rate of 0.1 falls quickly, then the loss bounces within a band and does not settle, even after many epochs. What is the most sensible next step?

    Choose one answer.

Boss challenge: Generalization, linear models and gradient descent

A longer check of the whole module. It is optional, and nothing else on the site depends on it.

  • 10 questions, taken from the lesson quizzes above.
  • Pass mark: 7 correct of 10.
  • You can try it as many times as you like.
  • A correct answer is kept, so a pass can build up across several tries.
  • If you miss some, you get links to the lesson sections to read again.

Checking answers needs JavaScript. You can still read every question and option below.

0 of 10 answered

Keyboard: arrow keys move between options. Space or Enter selects the focused option.

  1. Question 1 of 10You compared 200 model configurations on the same validation set, and the best one scores 0.92 there. What should you expect on a fresh test set?

    Choose one answer.

  2. Question 2 of 10Which of these are data leaks that make a validation score look better than production performance? Select all that apply.

    Choose all that apply.

  3. Question 3 of 10Training accuracy is 99% and validation accuracy is 80%. After checking for leakage and a mismatched validation set, which actions fit a high-variance diagnosis? Select all that apply.

    Choose all that apply.

  4. Question 4 of 10Ridge is fitted to the degree-12 polynomial at four lambdas. (lambda, train MSE, validation MSE): (0.01, 0.049, 0.326), (0.1, 0.062, 0.181), (1, 0.192, 0.220), (10, 0.522, 0.506). Which lambda do you pick, and why?

    Choose one answer.

  5. Question 5 of 10A logistic regression predicts p = 0.9 for a training example whose true label is y = 0 and whose features are x = [2, -1]. What is the log-loss gradient with respect to the weights for this one example?

    Choose one answer.

  6. Question 6 of 10You want a linear regression on 5 million rows and 200,000 sparse bag-of-words features. A colleague proposes the normal equation because it is exact and needs no learning rate. What is the best response?

    Choose one answer.

  7. Question 7 of 10A lender needs an estimated probability of default for each applicant, so it can set a decision threshold from the cost of a bad loan. A data scientist proposes training a linear classifier with hinge loss because it gives a clean margin. What is the problem?

    Choose one answer.

  8. Question 8 of 10Which statements about Huber loss are true? Select all that apply.

    Choose all that apply.

  9. Question 9 of 10You train linear regression with gradient descent on a table with house area in square feet (about 1,000 to 4,000) and number of bedrooms (1 to 5). The loss goes 0.7, 0.4, 3.1, 40, 5,000, then NaN. Which response addresses the cause?

    Choose one answer.

  10. Question 10 of 10A mini-batch run with a constant learning rate of 0.1 falls quickly, then the loss bounces within a band and does not settle, even after many epochs. What is the most sensible next step?

    Choose one answer.