Lsqfit

Latest version: v13.2.2

Safety actively analyzes 638720 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 7 of 13

8.0.2

==========================
Tiny change to keep lsqfit compatible with gvar v8.0 and later.

8.0.1

========================
Tiny (but somewhat conspicuous) fix in documentation.

8.0

=======================
The most significant addition is class BayesIntegrator for doing Bayesian
integrals using vegas (see the tutorial section on Bayesian Integrals, and the
new case study on Outliers and Bayesian Integrals). Bayesian integrals are
used in situations where the Gaussian approximation implicit in lsqfit breaks
down. By combining lsqfit results with vegas it becomes feasible to do these
integrals even with 10s of parameters. BayesIntegrator is built on top of
gvar.PDFIntegrator and so requires version 7.3 or later of gvar.

There are two additional changes, the second of which (caused by the first)

7.3

but they affect lsqfit:

- Function gvar.add_parameter_distribution has been added to allow new
prior distributions, in addition to log-normal and sqrt-normal. This
allows one, for example, to restrict a parameter to a particular
interval (see the Overview section on Non-Gaussian Priors).

- To signal a log-normal prior for a parameter 'c' in nonlinear_fit one must
now include an entry for prior['log(c)'] in the prior. Previously one could
leave out the parentheses in the key, using prior['logc'] instead. The
parenthesis are now essential. The same is true for sqrt-normal priors,
where one would include prior['sqrt(c)'], not prior['sqrtc'].

FIX FOR LEGACY CODE: To help convert legacy code, there is a new utility
function that adds the needed parentheses: use

prior = gvar.add_parameter_parentheses(prior)

to add parentheses to keys in dictionary prior of the form logc or sqrtdd
(which become log(c) or sqrt(dd)) in dictionary prior.

Other changes are behind the scenes: eg, more tests, more examples.

7.1

==================================
This version was made necessary by backwards incompatible changes in the
GSL library (with v2) used by lsqfit to do the fitting. The resulting
change in lsqfit *is* backwards compatible. Versions 7.1 and 7.1.0 are
the same.

- lsqfit now compiles with either of GSL versions 2.1 or 1.16. If 2.1 is
used there are two (minor?) enhancements: 1) there is a more sophisticated
stopping condition using parameter tol in place of abstol and reltol
(see multifit documentation); and 2) there is a new fitting algorithm
lmniel (in addition to lmsder and lmder) that is supposed to be faster
when fitting very large amounts of data with relatively few parameters.
Parameters abstol and reltol continue to work but are discouraged in
favor of tol=(reltol, abstol) or tol=reltol.

7.0

=======================
This is a modest change but includes some backwards incompatible changes in
the routine --- hence the increase to v7.0.

- nonlinear_fit now supports priors with log-normal and sqrt-normal
distributions provided parameter extend=True is set when it is called.
A parameter 'c', for example, in a parameter dictionary can be assigned a
log-normal prior by specifying a prior for 'logc' (or 'log(c)') in the fit
prior, rather than for 'c'. This is the only change required to switch from
'c' from a Gaussian prior to a log-normal prior; in particular the fit
function can be still be expressed in terms of 'c' (rather than 'logc') since
parameter dictionaries created by nonlinear_fit will have entries for both
'c' and 'logc'. sqrt-normal distributions are handled the same way, but
with, for example, 'sqrtc' or 'sqrt(c)' instead of 'logc'. This
functionality was available in earlier releases using the function decorator
transform_p, which is no longer needed and has been removed.This means that
fit.transformed_p is gone too --- just use fit.p.

- lsqfit.wavg no longer stores chi2, dof, etc as attributes of the
function. These are all attributes of the result returned by
wavg.

- debug=True checks for more errors. In particular it now looks for
stray GVars (not from the parameters) in fit functions. The only
way a GVar should get into a fit function is through the parameters.
Having other GVars there used to lead to a very obscure error message.
Running with debug=True gives a slightly more comprehensible message.

- fixed bug in nonlinear_fit.format which sometimes put stars in the wrong
place.

- modified nonlinear_fit.format to list extra entries generated when
using log-normal or sqrt-variables. So for a log-normal variable 'logc',
results for both 'logc' and 'c' will appear in the formatted output.

Page 7 of 13

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.