patrick-kidger / optimistix

Nonlinear optimisation (root-finding, least squares, ...) in JAX+Equinox. https://docs.kidger.site/optimistix/
Apache License 2.0
265 stars 12 forks source link

Check last point when using best so far minimiser #34

Open ColCarroll opened 6 months ago

ColCarroll commented 6 months ago

Fixes #33

There is some unnecessary looking lines

        best_f, best_aux = fn(state.best_y, args)
        best_loss = self._to_loss(state.best_y, best_f)

where I would expect to just use state.best_loss, but the test doesn't pass without it!

patrick-kidger commented 6 months ago

Thank you for the fix! Always happy to squash bugs :)