Back to the topic

AI · 4.1

Regression: Predicting Numbers with a Line

Section A: 10 multiple choice questions, 10 marks. Section B: 3 written questions, 12 marks. Total 22 marks.

Name

Class

Date

Mark  / 22

Section A

Circle the letter of the correct answer. One mark each.

  1. 1In the model score = 6.5 × hours + 33, what does 6.5 represent?1
    1. AThe extra marks predicted for each extra hour of revision
    2. BThe error of the model on the training data
    3. CThe average score of all the students in the data
    4. DThe predicted score for a student who did no revision
  2. 2A student's actual score is 70 and the model predicted 64. What is the residual?1
    1. A−6
    2. B134
    3. C36
    4. D6
  3. 3Why are residuals squared before averaging?1
    1. ASo the answer is always a whole number
    2. BSo positive and negative errors cannot cancel out
    3. CSo the model trains with fewer parameters
    4. DSo small errors count more than large ones
  4. 4Three residuals are 2, −2 and 4. What is the mean squared error?1
    1. A2
    2. B24
    3. C4/3
    4. D8
  5. 5Which point does the least squares line always pass through?1
    1. AThe origin, where x and y are both zero
    2. BThe point with the largest residual in the data
    3. CThe point made by the mean of x and the mean of y
    4. DThe first and last points in the data
  6. 6What shape is a linear regression model with two input features?1
    1. AA straight line
    2. BA sphere
    3. CA flat plane
    4. DA curve
  7. 7A model scores almost zero error on its training data but large errors on the test data. What has happened?1
    1. AOverfitting
    2. BScaling
    3. CRegularisation
    4. DUnderfitting
  8. 8What does an R² of 0 mean?1
    1. AThe model has no parameters left to learn
    2. BThe model is no better than always predicting the mean
    3. CThe model makes no errors at all on the data
    4. DThe model explains all of the variation
  9. 9What does regularisation do?1
    1. AAdds polynomial features to make curves
    2. BPenalises large weights to discourage overfitting
    3. CRemoves outliers from the training data
    4. DSplits the data into training and test sets
  10. 10Why do neural networks need gradient descent instead of a least squares formula?1
    1. AGradient descent always finds a perfect fit
    2. BLeast squares only works on images
    3. CFormulas cannot be run on a computer
    4. DNo exact formula exists for their best parameters

Section B

Answer in the space provided. The number of marks tells you how many separate points to make.

  1. 1ExplainExplain what the mean squared error measures and why the errors are squared.4
  2. 2ExplainA model is trained to predict house prices. It has a very low error on the training data and a high error on the test data. Explain what has happened and describe two ways to fix it.5
  3. 3InterpretA linear model predicts price = 2,100 × floor area − 4,500 × distance to station + 60,000. Interpret the two weights.3

Mark scheme

Section A

1A2D3B4D5C6C7A8B9B10D

Section B

1 Explain what the mean squared error measures and why the errors are squared. 4

One mark for each of the following, to a maximum of 4.

  • It measures the average error of a regression model
  • Residual: actual minus predicted
  • Squaring stops positive and negative errors cancelling
  • Squaring punishes large errors more

Model answer. The mean squared error measures how wrong a regression model is on average. For each example the residual, the actual value minus the predicted value, is squared, and the squares are averaged. Squaring stops positive and negative errors from cancelling each other out, and it punishes large errors much more heavily than small ones, so the model is pushed hardest to fix its biggest mistakes.

2 A model is trained to predict house prices. It has a very low error on the training data and a high error on the test data. Explain what has happened and describe two ways to fix it. 5

One mark for each of the following, to a maximum of 5.

  • The model is overfitting
  • It has learned the noise or memorised the training data
  • So it does not generalise to new data
  • Fix: a simpler model or fewer features
  • Fix: regularisation, or more training data

Model answer. The model is overfitting: it has learned the random noise in the training examples as well as the real pattern, effectively memorising them, so it does not generalise to houses it has not seen. One fix is to use a simpler model, such as fewer features or a lower degree polynomial. Another is regularisation, which adds a penalty for large weights so the model only becomes complex when the data really demands it. Collecting more training data also helps.

3 A linear model predicts price = 2,100 × floor area − 4,500 × distance to station + 60,000. Interpret the two weights. 3

One mark for each of the following, to a maximum of 3.

  • Each extra square metre adds about £2,100
  • Each extra km from the station lowers the price by about £4,500
  • With the other feature held fixed

Model answer. Each extra square metre of floor area adds about £2,100 to the predicted price, and each extra kilometre from the station reduces it by about £4,500. Each weight describes the effect of its feature with the other feature held fixed.