Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: <LinAlgError: SVD did not converge> #104

Open
nikospps opened this issue Jun 19, 2023 · 0 comments
Open

fix: <LinAlgError: SVD did not converge> #104

nikospps opened this issue Jun 19, 2023 · 0 comments

Comments

@nikospps
Copy link

When i use some transformed values 'macrodata.csv' the corresponding error returned:
/.conda/envs/testingdata/lib/python3.7/site-packages/ydata_quality/utils/correlations.py:73: RuntimeWarning: invalid value encountered in double_scalars
return np.sqrt(phi_sq_hat / np.min([k_hat - 1, r_hat - 1])) # Note: this is strictly positive
/home/nikospps/.conda/envs/testingdata/lib/python3.7/site-packages/ydata_quality/utils/correlations.py:73: RuntimeWarning: invalid value encountered in double_scalars
return np.sqrt(phi_sq_hat / np.min([k_hat - 1, r_hat - 1])) # Note: this is strictly positive
/home/nikospps/.conda/envs/testingdata/lib/python3.7/site-packages/ydata_quality/utils/correlations.py:73: RuntimeWarning: invalid value encountered in double_scalars
return np.sqrt(phi_sq_hat / np.min([k_hat - 1, r_hat - 1])) # Note: this is strictly positive
/home/nikospps/.conda/envs/testingdata/lib/python3.7/site-packages/ydata_quality/utils/correlations.py:73: RuntimeWarning: invalid value encountered in double_scalars
return np.sqrt(phi_sq_hat / np.min([k_hat - 1, r_hat - 1])) # Note: this is strictly positive

LinAlgError Traceback (most recent call last)
/tmp/ipykernel_9595/4020703881.py in
----> 1 dq = DataQuality(df=df).evaluate() # create the main class that holds all quality modules
2 # results = dq.evaluate() # run the tests

~/.conda/envs/testingdata/lib/python3.7/site-packages/ydata_quality/core/data_quality.py in evaluate(self, summary)
165 """
166 results = {
--> 167 name: engine.evaluate(*self._eval_args.get(name,[]), summary=False) for name, engine in self.engines.items()
168 }
169 self._store_warnings() # fetch all warnings from the engines

~/.conda/envs/testingdata/lib/python3.7/site-packages/ydata_quality/core/data_quality.py in (.0)
165 """
166 results = {
--> 167 name: engine.evaluate(*self._eval_args.get(name,[]), summary=False) for name, engine in self.engines.items()
168 }
169 self._store_warnings() # fetch all warnings from the engines

~/.conda/envs/testingdata/lib/python3.7/site-packages/ydata_quality/data_relations/engine.py in evaluate(self, df, dtypes, label, corr_th, vif_th, p_th, plot, summary)
83 results = {}
84 corr_mat, _ = correlation_matrix(df, self.dtypes, True)
---> 85 p_corr_mat = partial_correlation_matrix(corr_mat)
86 results['Correlations'] = {'Correlation matrix': corr_mat, 'Partial correlation matrix': p_corr_mat}
87 if plot:

~/.conda/envs/testingdata/lib/python3.7/site-packages/ydata_quality/utils/correlations.py in partial_correlation_matrix(corr_matrix)
134 """Returns the matrix of full order partial correlations.
135 Uses the covariance matrix inversion method."""
--> 136 inv_corr_matrix = np.linalg.pinv(corr_matrix)
137 diag = np.diag(inv_corr_matrix)
138 if np.isnan(diag).any() or (diag <= 0).any():

<array_function internals> in pinv(*args, **kwargs)

~/.conda/envs/testingdata/lib/python3.7/site-packages/numpy/linalg/linalg.py in pinv(a, rcond, hermitian)
2000 return wrap(res)
2001 a = a.conjugate()
-> 2002 u, s, vt = svd(a, full_matrices=False, hermitian=hermitian)
2003
2004 # discard small singular values

<array_function internals> in svd(*args, **kwargs)

~/.conda/envs/testingdata/lib/python3.7/site-packages/numpy/linalg/linalg.py in svd(a, full_matrices, compute_uv, hermitian)
1658
1659 signature = 'D->DdD' if isComplexType(t) else 'd->ddd'
-> 1660 u, s, vh = gufunc(a, signature=signature, extobj=extobj)
1661 u = u.astype(result_t, copy=False)
1662 s = s.astype(_realType(result_t), copy=False)

~/.conda/envs/testingdata/lib/python3.7/site-packages/numpy/linalg/linalg.py in _raise_linalgerror_svd_nonconvergence(err, flag)
95
96 def _raise_linalgerror_svd_nonconvergence(err, flag):
---> 97 raise LinAlgError("SVD did not converge")
98
99 def _raise_linalgerror_lstsq(err, flag):

LinAlgError: SVD did not converge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant