Formula

Linear Regression Analytic Solution

Linear regression uniquely presents an optimization problem with a direct analytic solution. By subsuming the bias term into the weight vector w\mathbf{w}—which is done by appending a column of all 11s to the design matrix X\mathbf{X}—the training objective becomes minimizing yXw2\|\mathbf{y} - \mathbf{X}\mathbf{w}\|^2. Setting the derivative of this loss with respect to w\mathbf{w} equal to 00 yields the intermediate derivative formula wyXw2=2Xop(Xwy)=0\partial_{\mathbf{w}} \|\mathbf{y} - \mathbf{X}\mathbf{w}\|^2 = 2 \mathbf{X}^ op (\mathbf{X} \mathbf{w} - \mathbf{y}) = 0, which directly gives the normal equation Xopy=XopXw\mathbf{X}^ op \mathbf{y} = \mathbf{X}^ op \mathbf{X} \mathbf{w}. Solving for w\mathbf{w} provides the optimal parameters: w=(XopX)1Xopy\mathbf{w}^* = (\mathbf{X}^ op \mathbf{X})^{-1}\mathbf{X}^ op \mathbf{y}. This closed-form solution exists only if the design matrix has full rank, ensuring that the matrix XopX\mathbf{X}^ op \mathbf{X} is invertible.

0

0

Updated 2026-05-02

Tags

Data Science

Ch.3 Prompting - Foundations of Large Language Models

Foundations of Large Language Models

Foundations of Large Language Models Course

Computing Sciences

D2L

Dive into Deep Learning @ D2L