| Model & Parameters |
LinearRegressionScratch (self.w, self.b) |
LinearRegression (the framework’s dense layer) |
Inherits Module.forward(X) -> self.net(X) |
| Loss Function |
\frac{1}{2|\mathcal{B}|}\|\hat{\mathbf{y}} - \mathbf{y}\|_2^2 |
Built-in MSE |
Omits 1/2 \implies loss & gradient are 2\times larger |
| Optimizer & Step Size |
Custom SGD at \eta = 0.03 |
Built-in SGD at \eta = 0.015 |
Halving \eta preserves the exact parameter update -\eta\nabla L |
| Noise Floor & Recovery |
Floor \sigma^2/2 = 5 \times 10^{-5} |
Floor \sigma^2 = 10^{-4} (\sqrt{\text{MSE}} = \sigma = 0.01) |
Both recover (\mathbf{w}^*, b^*) within \sim 3\sigma/\sqrt{n} \approx 10^{-3} |