Machine Learning Basics

A straight line y = ax + b is fitted by least squares to the three data points (x, y) = (1, 3), (2, 4) and (3, 8). What is the predicted value at x = 4?

  1. A10
  2. B10.5
  3. C12
Show answer and explanation

Answer: A. 10

Least squares chooses a and b so that the sum of the squared differences (residuals) between the actual values and the line is as small as possible. The mean of x is 2 and the mean of y is 5, so the slope is a = Σ(x − 2)(y − 5) ÷ Σ(x − 2)² = (2 + 0 + 3) ÷ 2 = 2.5 and the intercept is b = 5 − 2.5 × 2 = 0. The predicted value at x = 4 is therefore 2.5 × 4 = 10.

  • A. Correct. The regression line is y = 2.5x, so the prediction is 2.5 × 4 = 10.
  • B. This is the prediction of the line y = 2.5x + 0.5 through the first and last points, (1, 3) and (3, 8). Least squares takes the residuals of all three points into account.
  • C. This extends the line through the last two points, (2, 4) and (3, 8).
Practice this topic Back to topic

Related calculators

Books on Machine Learning Basics Ad

As an Amazon Associate I earn from qualifying purchases.

More Machine Learning Basics questions

  1. In logistic regression, z = 2x − 4 is passed through the sigmoid function σ(z) = 1 ÷ (1 + e^(−z)) and the result is output as the probability of being positive. What is the output when x = 2?
  2. A node of a decision tree holds 6 data points of class A and 4 of class B. What is the Gini impurity of this node?
  3. Which of the following correctly describes the difference between bagging (random forests and the like) and boosting in ensemble learning?
  4. The class of the 2D point (0, 0) is predicted with k-nearest neighbors. The training data consists of red points (1, 0), (3, 0) and (0, −3) and blue points (0, 2) and (−2, 1). Using Euclidean distance, which pair of predictions for k = 3 and k = 5 is correct?
  5. Which of the following describes a support vector machine (SVM)?