feat: warning for ill conditioned correlation matrix in correlated fit

only triggered for condition number > 1e13.
This commit is contained in:
Fabian Joswig 2022-07-18 16:25:33 +01:00
parent 06f2861390
commit 6c6a0f367e

View file

@ -486,7 +486,7 @@ def _standard_fit(x, y, func, silent=False, **kwargs):
condn = np.linalg.cond(corr)
if condn > 0.1 / np.finfo(float).eps:
raise Exception(f"Cannot invert correlation matrix as its condition number exceeds machine precision ({condn:1.2e})")
if condn > 1 / np.sqrt(np.finfo(float).eps):
if condn > 1e13:
warnings.warn("Correlation matrix may be ill-conditioned, condition number: {%1.2e}" % (condn), RuntimeWarning)
chol = np.linalg.cholesky(corr)
chol_inv = scipy.linalg.solve_triangular(chol, covdiag, lower=True)