Ceres Solver glue
Martin Karlgren <[email protected]>
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Message-ID | <[email protected]> |
Hi everyone, In case anyone is interested, I just remembered my simple Ceres Solver glue for Pike: https://github.com/marty-se/pike-ceres Ceres Solver (http://ceres-solver.org) "is an open source C++ library for modeling and solving large, complicated optimization problems”. The glue is currently limited to nonlinear least-squares problems that can be modeled using a cost function. While you normally need to provide a Jacobian matrix (i.e. partial derivatives) when doing nonlinear least-squares fitting, the nice thing about Ceres is that it can calculate derivatives all by itself thanks to automatic differentiation (https://en.wikipedia.org/wiki/Automatic_differentiation, i.e. not the same thing as numerical differentiation). The Pike glue supports autodiff by overloading operators and numerical functions in the base cost function class – it then constructs a parse tree/expression stack internally, which can be reused. That is, the Pike cost function only needs to be evaluated once, rather than in each iteration of the solver – which is obviously good for performance. And, it allows multithreaded evaluation. Example usage for parameter estimation from sample data with gaussian noise: https://github.com/marty-se/pike-ceres/blob/master/test.pike Why did I do it? Well, I was on paternal leave, my son slept a lot, and for some reason I became interested in parameter estimation and stuff. Weird. /Marty