Releases: brian-team/brian2modelfitting
Releases · brian-team/brian2modelfitting
brian2modelfitting v0.4
This new release adds a number of new features and fix some important bugs. We strongly encourage all users to update.
New features
- A new method
TraceFitter.refinewill use a standard gradient-based optimization method to further minimize the error after fitting. This can greatly enhance the quality of fits when theTraceFitter.fitmethod is close to the optimal solution and only advances very slowly. This functionality is based on the lmfit package. It can optionally analytically calculate the gradient of the model equations (instead of numerically approximating them), but note that depending on the equations this process can take a long time or fail. (#28, #29). - As an alternative to specifying
t_start, you can now individually weigh different parts of the simulation/recording with thet_weightsargument, to emphasize/deemphasize the error at certain times (#31). - Values returned to the user (parameters found during the fit, total error), as well as values displayed in the progress reports (
callback) now use physical units. Since this is a change that can break existing code that expects values to be dimensionless, the feature can be switched off by creating theFitterobject withuse_units=False - The model equations now have access to some properties of the fitting process. E.g. when fitting a variable
x, the target value can be accessed astarget_x. In addition, a variableiterationstores the current round of the fitting process (by default it is set to a very high value ingenerateandrefine, based on the assumption that it is used to implement some coupling to the target variable that inversely depends on the iteration). The starting value, and the constant value used inTraceFitter.refineandFitter.generatecan be configured using arguments (#33, #36) - During fitting, a
penaltyterm (that should correspond to the name of an expression defined in the model) can be defined. This term will be added to the total error and can be used for regularization. Fitter.generatecan now generate traces for multiple variables at the same time (#34)
Bug fixes
- There were some issues with the "recommendation" obtained from Nevergrad (see issue #16). With the fix, the parameters returned at the end of the fitting process are now simply the parameters that resulted in the smallest error so far.
- Running
Fitter.fitagain after a call toFitter.generateis now handled better and also works in standalone mode. (#15) - A warning during the import of
scikit-learnis now suppressed.
Backward-incompatible changes
- The "Gamma Factor with rate correction", implemented by the
GammaFactormetric, previously defined the best possible match as having error -1, whereas smallest error for the Gamma Factor without rate correction was 0. The error has been shifted so that it is now >=0 in both cases (#32)