choderalab / pymbar

Python implementation of the multistate Bennett acceptance ratio (MBAR)
http://pymbar.readthedocs.io
MIT License
235 stars 91 forks source link

MBAR estimator automatically choosing the usable method #424

Open xiki-tempula opened 3 years ago

xiki-tempula commented 3 years ago

As is stated in #419, BFGS and adaptive each have cases that they cannot resolve, which could be resolved by the other estimator. I'm thinking of adding a more robust solver in the downstream package alchemlyb. The logic might be

try:
    MBAR('adaptive')
except:
    MBAR('BFGS')

I know that 4.0 will be out and things will be changed. So I wonder in 4.0, will there be a method that will fall back to BFGS when adaptive doesn't work or the user will have to deal with this by themselves?

jchodera commented 3 years ago

@mrshirts : It would be extremely useful to fall back to the most robust (iterative) solver if the fancier solvers do not work, but sometimes a user will want to only use the specified solver. Perhaps an optional argument fallback=True by default, with the user able to specify fallback=False if they only want to use a particular solver?

mrshirts commented 3 years ago

It would be extremely useful to fall back to the most robust (iterative) solver if the fancier solvers do not work

It's more complicated than this , because in some of the cases, it fails to converge with the iterative solver, but minimizes fine with a scipy solver. Improved robustness does need to be implemented though, and I'm trying to find time to get this finished before school starts in a month (along with GPU optimizations).

When adaptive fails, IIRC, it often never leaves the iterative solver, so adaptive failing usually means -> iterative failing.

jchodera commented 3 years ago

The suggestion is to fall back to a different solver by default if the selected solver fails. We can try all the solvers, prioritizing the fastest or requested solver. If none of the solvers succeeds, we can give up.

mrshirts commented 2 years ago

Attempting to solve with #446