MLE & MAP

Maximum Likelihood Estimation (MLE) and Maximum A Posteriori (MAP) estimation are the two statistical principles that turn “SLAM” from a vague goal into a concrete optimization problem. Almost every SLAM back-end — filter or smoother — is computing one of these two estimates.

Bayes’ theorem sets the stage

Let x\mathbf{x} be the state (robot poses and map) and z\mathbf{z} the measurements (feature observations, IMU readings). Bayes’ theorem relates what we want (the posterior) to what our sensor and motion models give us:

p(xz)=p(zx)p(x)p(z)p(zx)p(x)p(\mathbf{x} \mid \mathbf{z}) = \frac{p(\mathbf{z} \mid \mathbf{x})\, p(\mathbf{x})}{p(\mathbf{z})} \propto p(\mathbf{z} \mid \mathbf{x})\, p(\mathbf{x})

The two estimators

MAP picks the state maximizing the posterior:

xMAP=argmaxxp(zx)p(x)\mathbf{x}^*_{\text{MAP}} = \arg\max_{\mathbf{x}}\, p(\mathbf{z} \mid \mathbf{x})\, p(\mathbf{x})

MLE drops the prior (equivalently, assumes a uniform prior) and maximizes the likelihood alone:

xMLE=argmaxxp(zx)\mathbf{x}^*_{\text{MLE}} = \arg\max_{\mathbf{x}}\, p(\mathbf{z} \mid \mathbf{x})

MAP = MLE + prior. In SLAM terms: pure bundle adjustment over image observations is MLE; add motion-model factors, IMU factors, or a prior on the first pose, and you are doing MAP.

From probabilities to least squares

The reason SLAM back-ends are least-squares solvers and not generic probabilistic inference engines is the Gaussian noise assumption. Take a measurement model z=h(x)+v\mathbf{z} = h(\mathbf{x}) + \mathbf{v} with vN(0,Σ)\mathbf{v} \sim \mathcal{N}(\mathbf{0}, \Sigma). Then

p(zx)exp ⁣(12zh(x)Σ12)p(\mathbf{z} \mid \mathbf{x}) \propto \exp\!\left(-\tfrac{1}{2}\,\|\mathbf{z} - h(\mathbf{x})\|^2_{\Sigma^{-1}}\right)

where eΣ12=eTΣ1e\|\mathbf{e}\|^2_{\Sigma^{-1}} = \mathbf{e}^T \Sigma^{-1} \mathbf{e} is the squared Mahalanobis distance. Taking the negative logarithm — which turns maximization into minimization and products of independent measurements into sums — the MAP problem becomes:

x=argminx[th(xt)ztRt12+tf(xt1,ut)xtQt12]\mathbf{x}^* = \arg\min_{\mathbf{x}} \left[ \sum_t \|h(\mathbf{x}_t) - \mathbf{z}_t\|^2_{R_t^{-1}} + \sum_t \|f(\mathbf{x}_{t-1}, \mathbf{u}_t) - \mathbf{x}_t\|^2_{Q_t^{-1}} \right]

The first sum is the observation cost (e.g. reprojection error with measurement covariance RtR_t); the second is the motion-model cost (odometry/IMU, with process covariance QtQ_t). Three consequences worth internalizing:

Filters vs. smoothers

The Extended Kalman Filter computes a recursive Gaussian approximation of the posterior one time step at a time (predict with p(x)p(\mathbf{x}), update with p(zx)p(\mathbf{z} \mid \mathbf{x})), while modern smoothing back-ends solve the full MAP problem over the whole trajectory with non-linear optimization. Both are chasing the same posterior; they differ in what they approximate and when they linearize.

Why it matters for SLAM

MLE/MAP is the bridge between the probabilistic formulation of SLAM and the optimization machinery that solves it. Every design decision downstream — why residuals are weighted by inverse covariances, why bundle adjustment minimizes squared reprojection error, why a prior factor anchors the gauge freedom, why outliers demand robust kernels — is a direct corollary of “MAP under Gaussian noise equals weighted nonlinear least squares”. If you can re-derive that one line, most back-end papers become easy reading.