Web Analytics Made
Easy - StatCounter

Interpretation of the final_cost field in Ceres.

I love using the Ceres solver, but couldn’t figure out why when I computed the value of the cost function using my code, it was different from final_cost field of a Solver::Summary object.

Finally, I figured out that I constructed a cost function as

\[\sum_i \| f_i(x_i, \dots , x_{ik}) \|^2 \label{eqone}\]

and in Ceres, the cost function is assumed to have this form, Ceres link:

\[\frac{1}{2}\sum_i \| f_i(x_i, \dots , x_{ik}) \|^2 \label{eqtwo}\]

The only difference is that \(\frac{1}{2}\) in the Ceres version. To convert the final final_cost to my cost function, I need to multiply final_cost by two.

This was such a simple thing, but I spent more time than I would have liked figuring it out, so here this is as a TIL.

© Amy Tabb 2018 - 2022. All rights reserved. The contents of this site reflect my personal perspectives and not those of any other entity.