How To Choosing the Right Formulation for Residuals #1058
Unanswered
Youhaochan
asked this question in
Q&A
Replies: 1 comment
-
Ceres Solver will square the residual, which is why we do not want you to square the residual. More generally your residual function should reflect the negative log likelihood of your probabilistic model. I do not know the ROS navigation2 code base. but taking a quick look at it, the line you are pointing to is just one term in the full residual, some of which are squared and some of which are not. So they just came up with some algebraic combination of things. I would ask the original authors of the code. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was reading the tutorial at http://ceres-solver.org/nnls_tutorial.html, specifically the curve fitting example. In the code snippet, the residual is defined as residual[0] = y_ - exp(m[0] * x_ + c[0]);. I am curious why it is not set as residual[0] = y_ - exp(m[0] * x_ + c[0]) * y_ - exp(m[0] * x_ + c[0]); or ceres::abs(y_ - exp(m[0] * x_ + c[0])). Since this is a least squares problem, the cost function should be squared manually, or else the solver will automatically square the cost. In the path smoothing software used in ROS navigation2, they explicitly square the residual https://github.com/ros-planning/navigation2/blob/2ecc91e47bb09485289531144ab9b038f4cfc432/nav2_constrained_smoother/include/nav2_constrained_smoother/smoother_cost_function.hpp#L172. I am uncertain which approach is correct.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions