Least Squares Estimation - Linear and Weighted Least Squares
In questa pagina 6
Setting
"Real world": a function with the assumption ; we observe . To make the problem tractable we choose a model class and select such that (see System Identification - Estimation Problem and Parametric Model ClassesEstimation means reconstructing an unknown function from noisy samples; the problem is ill posed, so one fixes a parametric model class, and the basic objects (statistic, estimator, estimate) are defined, with the gray-box and black-box versions for dynamical systems.System Identification - Estimation Problem and Parametric Model Classes →). To "fit" a dataset we need to interpolate it with some .
Least squares (LS) estimator
Idea. Penalise the squared deviations between the observed values and the estimated , i.e. : where .
- This is the problem of minimising the mismatch between observed data and estimated data: it does not address the "generalisation" problem.
- In general can be any function, requiring numerical optimisation.
Linear LS
Special case: linear. (equivalently ), with , and assume . Then where for a vector , . This is linear regression, and is the regression matrix: A closed-form (analytical) solution is available (if ).
Idea: compute the gradient and set it equal to zero. (the board writes the gradient as and then drops the factor 2; the exact gradient is , a nonzero constant factor that does not change the equation). Then If is invertible we can compute which is possible if and only if the columns of are independent. (When is not invertible see Pseudoinverse and SVD for Rank-Deficient Least SquaresWhen the matrix of the normal equation is not invertible the least squares problem has infinitely many solutions; using the singular value decomposition and the pseudoinverse one picks the solution of minimal norm, derived here step by step.Pseudoinverse and SVD for Rank-Deficient Least Squares →.)
Weighted LS
Some data points may be "more important" than others: they provide more accurate or reliable information about . Then If is large, the data point is more "important": LS estimation tries to minimise "more" than the others.
Example. If and , then one rule of thumb is .
Weighted linear LS
With : whose solution is How good this estimator is, for with the noise covariance, is the subject of Performance of the Linear Least Squares EstimatorWith zero-mean noise of covariance P, the weighted least squares estimator with weight P inverse is unbiased and has the smallest variance among all unbiased estimators that are linear in the data; the proof compares it with an arbitrary linear unbiased estimator.Performance of the Linear Least Squares Estimator →.
Example - coefficients of a DC motor
A DC motor: a voltage source drives a resistor-inductor circuit with current ; the rotor has inertia , angle and a disturbance torque . The mechanical equation is where the viscous friction coefficient and the dry friction torque (circled on the board) are the coefficients to be estimated.
At constant speed , so Data points (always assume ): and . To be estimated: . Writing :
Example - fitting a straight line (recap)
: the model structure is the unknown ("?") and is the noise. In the recap picture, the true (a curve) is evaluated at points ; the measured values are the true values plus an error; the LS cost sums the squared vertical distances between the measured and the model (weighted by ).
Here the true function is (unknown, including its structure). The observations are with and (the first entry is hard to read in the strip). Choose the linear model ; the unknown ground truth is . Linear LS: with The fitted line lies close to the true line although the data are scattered around it.
Versione ripasso
- LS estimator: , . It minimises the mismatch between data and model and does not address generalisation (System Identification - Estimation Problem and Parametric Model ClassesEstimation means reconstructing an unknown function from noisy samples; the problem is ill posed, so one fixes a parametric model class, and the basic objects (statistic, estimator, estimate) are defined, with the gray-box and black-box versions for dynamical systems.System Identification - Estimation Problem and Parametric Model Classes →). For a general it needs numerical optimisation.
- Linear LS: , cost , with the rows of the regression matrix equal to . Setting the gradient to zero gives the normal equation , so when the columns of are independent. Otherwise see Pseudoinverse and SVD for Rank-Deficient Least SquaresWhen the matrix of the normal equation is not invertible the least squares problem has infinitely many solutions; using the singular value decomposition and the pseudoinverse one picks the solution of minimal norm, derived here step by step.Pseudoinverse and SVD for Rank-Deficient Least Squares →.
- Weighted LS: cost , ; with , . Rule of thumb when has variance : . The choice is analysed in Performance of the Linear Least Squares EstimatorWith zero-mean noise of covariance P, the weighted least squares estimator with weight P inverse is unbiased and has the smallest variance among all unbiased estimators that are linear in the data; the proof compares it with an arbitrary linear unbiased estimator.Performance of the Linear Least Squares Estimator →.
- DC motor: at constant speed the torque is , so the data are , , and the unknown is , one row of per sample.
- Straight-line recap: true , six points with values , model . The columns of are independent and , close to the true .
- Typical mistakes: using the normal equation when the columns of are dependent, forgetting the weights , reading the order of wrongly.
Teoria collegata
- Introduction to Machine Learning - Program Map
- Linear Regression
- A Priori Identifiability of Parametric Models
- Maximum Likelihood Estimation - Overview
- Performance of the Linear Least Squares Estimator
- Pseudoinverse and SVD for Rank-Deficient Least Squares
- System Identification - Estimation Problem and Parametric Model Classes