GATE DA 2025 · Simple Linear Regression

NAT · 1 mark · Problem ML-REGR-0016

Given data \(\{(-1, 1), (2, -5), (3, 5)\}\) of the form \((x, y)\), we fit a model \(y = w x\) using linear least-squares regression. The optimal value of \(w\) (rounded off to three decimal places) is .

Numerical answer (NAT).

Solve it on GATE DA practice →More Supervised Learning — Regression problems

Show the worked solutionWe are fitting a linear regression model through the origin (no intercept term):\[ y = w x \]The least-squares objective function to minimize is the sum of squared residuals:\[ S(w) = \sum_{i=1}^n (y_i - w x_i)^2 \]To find the optimal \(w\), we take the derivative with respect to \(w\) and set it to zero:\[ \frac{dS}{dw} = -2 \sum_{i=1}^n x_i (y_i - w x_i) = 0 \]\[ \sum_{i=1}^n x_i y_i - w \sum_{i=1}^n x_i^2 = 0 \implies w = \frac{\sum_{i=1}^n x_i y_i}{\sum_{i=1}^n x_i^2} \]Given data points: 1. \((x_1, y_1) = (-1, 1)\) 2. \((x_2, y_2) = (2, -5)\) 3. \((x_3, y_3) = (3, 5)\)Calculate the numerator \(\sum x_i y_i\):\[ \sum x_i y_i = (-1)(1) + (2)(-5) + (3)(5) = -1 - 10 + 15 = 4 \]Calculate the denominator \(\sum x_i^2\):\[ \sum x_i^2 = (-1)^2 + (2)^2 + (3)^2 = 1 + 4 + 9 = 14 \]Calculate the optimal \(w\):\[ w = \frac{4}{14} = \frac{2}{7} \approx 0.285714 \]Rounding to three decimal places gives \(0.286\).Answer: 0.286

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com