LBHB / NEMS0

THIS VERSION OF NEMS IS NO LONGER SUPPORTED. PLEASE USE THE NEW NEMS REPOSITORY OR INSTALL NEMS_DB TO GET NEMS0 SUPPORT.
GNU General Public License v3.0
8 stars 4 forks source link

Added support for per-module bounds defined in modelspecs. #80

Closed jacobpennington closed 6 years ago

jacobpennington commented 6 years ago

Added bounds_vector function in nems/fitters/mappers, which returns a function that maps bounds dictionaries (with a structure similar to phi) to a flattened vector for use by coordinate descent and scipy_minimize fitters.

Incorporated bounds function into fit_basic and fit_iteratively, as well as coordinate_descent and scipy_minimize.

Fixed a minor bug in distributions/exponential.py

As an aside, the bounds are set up to be perfectly happy with entire modelspecs or parts of modelspecs that don't define bounds, or even defining bounds for one parameter but not others. So this shouldn't create a need to start adding blank bounds into all of our keywords - only the ones that need them.

Per the example in the docstring for bounds_vector, bounds can be defined in the modelspec in a manner similar to phi: {'fn': 'some.module', 'phi': {'p1': 1.0, 'p2': 2.0}, 'bounds': {'p1': (-3.0, 3.0), 'p2': (0.0, None)}}