Sameer Agarwal | 8ed29a7 | 2012-06-07 17:04:25 -0700 | [diff] [blame] | 1 | %!TEX root = ceres-solver.tex |
Sameer Agarwal | d3eaa48 | 2012-05-29 23:47:57 -0700 | [diff] [blame] | 2 | \chapter{Non-linear Least Squares} |
| 3 | \label{chapter:tutorial:nonlinsq} |
| 4 | Let $x \in \reals^n$ be an $n$-dimensional vector of variables, and |
| 5 | $F(x) = \left[f_1(x); \hdots ; f_k(x)\right]$ be a vector of residuals $f_i(x)$. |
| 6 | The function $f_i(x)$ can be a scalar or a vector valued |
| 7 | function. Then, |
| 8 | \begin{equation} |
| 9 | \arg \min_x \frac{1}{2} \sum_{i=1}^k \|f_i(x)\|^2. |
| 10 | \end{equation} |
Sameer Agarwal | 97fb6d9 | 2012-06-17 10:08:19 -0700 | [diff] [blame] | 11 | is a Non-linear least squares problem~\footnote{Ceres can solve a more general version of this problem, but for pedagogical reasons, we will restrict ourselves to this class of problems for now. See section~\ref{chapter:overview} for a full description of the problems that Ceres can solve}. Here $\|\cdot\|$ denotes the Euclidean norm of a vector. |
Sameer Agarwal | d3eaa48 | 2012-05-29 23:47:57 -0700 | [diff] [blame] | 12 | |
| 13 | Such optimization problems arise in almost every area of science and engineering. Whenever there is data to be analyzed, curves to be fitted, there is usually a linear or a non-linear least squares problem lurking in there somewhere. |
| 14 | |
| 15 | Perhaps the simplest example of such a problem is the problem of Ordinary Linear Regression, where given observations $(x_1,y_1),\hdots, (x_k,y_k)$, we wish to find the line $y = mx + c$, that best explains $y$ as a function of $x$. One way to solve this problem is to find the solution to the following optimization problem |
| 16 | \begin{equation} |
| 17 | \arg\min_{m,c} \sum_{i=1}^k (y_i - m x_i - c)^2. |
| 18 | \end{equation} |
| 19 | With a little bit of calculus, this problem can be solved easily by hand. But what if, instead of a line we were interested in a more complicated relationship between $x$ and $y$, say for example $y = e^{mx + c}$. Then the optimization problem becomes |
| 20 | \begin{equation} |
| 21 | \arg\min_{m,c} \sum_{i=1}^k \left(y_i - e^{m x_i + c}\right)^2. |
| 22 | \end{equation} |
| 23 | This is a non-linear regression problem and solving it by hand is much more tedious. Ceres is designed to help you model and solve problems like this easily and efficiently. |