> ## Documentation Index
> Fetch the complete documentation index at: https://aegean.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Robust Estimation

> Least squares fits and how to keep outliers from bending them.

So far in this book you have fitted models with stochastic gradient descent (SGD). That is the approach the neural network chapters build on, because a network has many parameters and is trained on a large data set. Many estimation problems in robotics and computer vision look different. They have tens to thousands of measurements and a handful of parameters. For those problems the standard tool is least squares: setting the gradient of the squared error to zero gives the normal equations, and solving them gives the exact minimizer in one step, without a learning rate.

Least squares by itself is a fitting criterion. It picks the parameters that minimize the sum of squared residuals and says nothing about probability. It has a probabilistic reading only when you add a model of the noise. If the residuals are independent and Gaussian with a common variance $\sigma^2$, the least squares solution is the maximum likelihood estimate, as the [conditional maximum likelihood](https://aegean.ai/aiml-common/lectures/optimization/maximum-likelihood/conditional_maximum_likelihood.md) section shows, and its covariance is $\sigma^2(\boldsymbol\Phi^\top\boldsymbol\Phi)^{-1}$, which a filter or a planner can use. The methods of this chapter rely on that reading. The RANSAC threshold and the inlier and outlier mixture both come from a Gaussian model of the inlier noise, and each robust loss corresponds to a noise distribution with heavier tails than the Gaussian.

The table lists places where least squares is used, and the sections of this book that cover them.

| Problem | Least squares form | Section |
| - | - | - |
| Camera calibration | Linear DLT for a starting estimate, then nonlinear least squares on the reprojection error | [Camera modeling](https://aegean.ai/aiml-common/lectures/sensor-models/cameras/camera-modeling/index.md) |
| Homography and essential matrix | DLT on the correspondences that RANSAC keeps | [Homographies](https://aegean.ai/aiml-common/lectures/3d-reconstruction/homographies/index.md), [visual SLAM](https://aegean.ai/aiml-common/lectures/rse/visual-slam/index.md) |
| Scan alignment (ICP) | Rigid fit to paired points, solved in closed form with an SVD | [Scan registration](https://aegean.ai/aiml-common/lectures/rse/scan-registration/index.md) |
| SLAM back ends | Sparse nonlinear least squares over poses and landmarks, solved by Gauss-Newton or Levenberg-Marquardt | [SLAM](https://aegean.ai/aiml-common/lectures/rse/slam/index.md) |
| Kalman filter | Recursive least squares when the model is linear and the noise Gaussian | [Kalman filters](https://aegean.ai/aiml-common/lectures/rse/kalman-filters/index.md) |
| Inverse kinematics | Damped least squares on the manipulator Jacobian | |
| Robot identification | Linear least squares for masses, inertias and friction, because the dynamics are linear in them | |
| Sensor calibration | Linear or nonlinear least squares for wheel radii, IMU biases and the hand-eye transform | |

Least squares gives every measurement the same weight and penalizes the square of its residual, so a few wrong measurements can move the fit far from the truth. This chapter starts from the least squares fit of a line and shows how one bad point moves it. It then covers the methods that limit that damage. Robust losses and the inlier and outlier mixture reweight the data around a current fit. RANSAC needs no starting fit and finds the inliers by fitting many small random samples.

> [card] [Least Squares with Outliers](https://aegean.ai/aiml-common/lectures/robust-estimation/least-squares-outliers/index.md)
>
> The least squares baseline, leverage, robust losses and the inlier and outlier mixture.

> [card] [RANSAC](https://aegean.ai/aiml-common/lectures/robust-estimation/ransac/index.md)
>
> Fitting minimal random samples and keeping the largest consensus set.

> [card] [RANSAC Applications](https://aegean.ai/aiml-common/lectures/robust-estimation/ransac-applications/index.md)
>
> A floor plane in a point cloud and the settings of a homography estimate.

***

Found an error on this page? [Report an issue](https://github.com/aegean-ai/eaia-feedback/issues/new?template=page-issue.yml\&page=/aiml-common/lectures/robust-estimation).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.