Reading club I. Linear regression
Notes from an ML reading club session on machine-learning interatomic potentials.
The electronic Hamiltonian depends parametrically on the nuclear positions, so its eigenvalues, the potential energy surface, are determined once the nuclei are fixed (the Born-Oppenheimer approximation underpins this separation of electronic and nuclear degrees of freedom). The goal of a machine-learning interatomic potential is to fit a parameterized function that reproduces this potential energy surface across all nuclear configurations. Before any of the modern machinery, it is worth getting linear regression completely right, because most of the field’s kernel methods are linear regression in disguise.
Setup
We propose that the target function is linear. In one dimension, we seek the best for a given dataset. In dimensions, the model becomes
where is the weight vector and is the dimensionality of the feature space (the bias is absorbed by appending a constant feature to each input). The objective is to learn, that is, to fit the weights given a set of labeled training pairs .
Primal form
We minimize the least-squares loss, which measures the squared deviation between predictions and labels,
Setting yields the normal equations in matrix form, where is the design matrix with rows ,
Solving directly gives the primal form
Regularization
Adding an penalty to the loss trades a slightly higher training error for better generalization. This is ridge regression. The modified normal equations become , which is always invertible for . The regularizer biases toward smaller weights, preventing overfitting to noise.
Dual form
We can rewrite the prediction as a linear combination of the training labels. The dual form is properly derived via the representer theorem, which states that the optimal weight vector lies in the span of the training data, . Substituting yields
The quantity appearing inside can be viewed as projecting the test point onto basis vectors defined by the training data. Intuitively, the solution already lives in the span of the training data, and we are finding the right linear combination. Notice that the predictions depend on the inputs only through dot products , which is a prelude to kernelization. Replace the dot products with a kernel and we implicitly work in a higher-dimensional feature space. That move gets its own session.
Maximum likelihood
Why least squares and not some other loss? Suppose the training labels are noisy observations of the true function, drawn from a Gaussian distribution centered at the model prediction with variance ,
which is equivalent to assuming additive i.i.d. Gaussian noise. For a given , the likelihood of observing the full training set is
The normalization factor does not depend on , so maximizing the likelihood is the same as maximizing the log-likelihood, which up to constants reduces to minimizing
and this is the least-squares loss again. The maximum likelihood estimator coincides with the ordinary least-squares solution, and under Gaussian noise least squares is thus the statistically optimal estimator.