apoorvalal / pyensmallen

python wrapper for the ensmallen c++ library for numerical optimization
https://pypi.org/project/pyensmallen/
MIT License
4 stars 1 forks source link

Complete the L_BFGS wrapper. #2

Closed matthewwardrop closed 3 months ago

matthewwardrop commented 3 months ago

I was fiddling around with ensmallen tonight and ended up cleaning up the binding a little, and adding support for all of hyperparameters and constructors of the BFGS optimizer (including mutating these hyperparameters from Python).

I'd forgotten how much I love pybind11.

The patch also renames FunctionWrapper to DifferentiableFunctionWrapper in line with upstream nomenclature, in case we want to implement some of the other solvers/optimizers too. It seems well-structured and so an automated wrapper generation might work nicely if we want to shoot for completeness.

apoorvalal commented 3 months ago

agree re: structure; the consistency of signatures is really appealing.

so an automated wrapper generation might work nicely if we want to shoot for completeness.

have no experience with this sort of thing; sounds magical - have any pointers? Would be neat to have (although problems that can't be solved with BFGS are quite annoying haha)

apoorvalal commented 3 months ago

pr checkout inexplicably created a new branch on main rather than your fork so i incorporated your changes into this and merged. https://github.com/apoorvalal/pyensmallen/pull/3

tried my hand at using ensmallen's templatization in the bindings [with help from claude 3.5]. seems to work reasonably [although first order methods like adam truly are finicky relative to BFGS]