mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-15 12:03:42 +02:00
Merge branch 'develop' into documentation
This commit is contained in:
commit
cf305354d4
3 changed files with 40 additions and 5 deletions
15
.github/workflows/binder.yml
vendored
Normal file
15
.github/workflows/binder.yml
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
name: binder
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
|
||||
jobs:
|
||||
Create-MyBinderOrg-Cache:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: cache binder build on mybinder.org
|
||||
uses: jupyterhub/repo2docker-action@master
|
||||
with:
|
||||
NO_PUSH: true
|
||||
MYBINDERORG_TAG: ${{ github.event.ref }} # This builds the container on mybinder.org with the branch that was pushed on.
|
|
@ -264,9 +264,19 @@ def total_least_squares(x, y, func, silent=False, **kwargs):
|
|||
|
||||
fitp = out.beta
|
||||
try:
|
||||
hess_inv = np.linalg.pinv(jacobian(jacobian(odr_chisquare))(np.concatenate((fitp, out.xplus.ravel()))))
|
||||
hess = jacobian(jacobian(odr_chisquare))(np.concatenate((fitp, out.xplus.ravel())))
|
||||
except TypeError:
|
||||
raise Exception("It is required to use autograd.numpy instead of numpy within fit functions, see the documentation for details.") from None
|
||||
condn = np.linalg.cond(hess)
|
||||
if condn > 1e8:
|
||||
warnings.warn("Hessian matrix might be ill-conditioned ({0:1.2e}), error propagation might be unreliable.\n \
|
||||
Maybe try rescaling the problem such that all parameters are of O(1).".format(condn), RuntimeWarning)
|
||||
try:
|
||||
hess_inv = np.linalg.inv(hess)
|
||||
except np.linalg.LinAlgError:
|
||||
raise Exception("Cannot invert hessian matrix.")
|
||||
except Exception:
|
||||
raise Exception("Unkown error in connection with Hessian inverse.")
|
||||
|
||||
def odr_chisquare_compact_x(d):
|
||||
model = func(d[:n_parms], d[n_parms:n_parms + m].reshape(x_shape))
|
||||
|
@ -542,9 +552,19 @@ def _standard_fit(x, y, func, silent=False, **kwargs):
|
|||
|
||||
fitp = fit_result.x
|
||||
try:
|
||||
hess_inv = np.linalg.pinv(jacobian(jacobian(chisqfunc))(fitp))
|
||||
hess = jacobian(jacobian(chisqfunc))(fitp)
|
||||
except TypeError:
|
||||
raise Exception("It is required to use autograd.numpy instead of numpy within fit functions, see the documentation for details.") from None
|
||||
condn = np.linalg.cond(hess)
|
||||
if condn > 1e8:
|
||||
warnings.warn("Hessian matrix might be ill-conditioned ({0:1.2e}), error propagation might be unreliable.\n \
|
||||
Maybe try rescaling the problem such that all parameters are of O(1).".format(condn), RuntimeWarning)
|
||||
try:
|
||||
hess_inv = np.linalg.inv(hess)
|
||||
except np.linalg.LinAlgError:
|
||||
raise Exception("Cannot invert hessian matrix.")
|
||||
except Exception:
|
||||
raise Exception("Unkown error in connection with Hessian inverse.")
|
||||
|
||||
if kwargs.get('correlated_fit') is True:
|
||||
def chisqfunc_compact(d):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue