ValueError: The subspace of Q derived by shifting a non-constant first (Schur)vector #1233
Unanswered
elgra
asked this question in
Method/Algorithm
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Dear all,
since recently when trying to execute the following step:
g.fit(n_states=10, cluster_key="leiden")g.plot_macrostates(which="all")I'm running into the following error. Would you have any suggestions, what might cause this error? I was trying to find a possible reason for it but without success. Since this error pops out only since recently and since it's not the case when working with other data set, I assume the error is not due to the environment issues.
Any suggestions will be very much appreciated!
g.fit(n_states=10, cluster_key="leiden")`ERROR:root:[[-2.74098831e-03 -7.92506849e-04 -4.62006579e-04 ... 5.48897836e-04
-4.46117253e-04 -5.87294109e-04]
[-2.74537506e-03 -4.22060822e-04 -5.62269660e-04 ... -1.11471560e-04
-8.69961090e-04 1.05912137e-03]
[-2.75787222e-03 -8.39866791e-04 6.06816683e-05 ... -5.34630419e-04
8.54067104e-05 -4.98222078e-04]
...
[-2.72375611e-03 2.86133521e-04 -1.37655462e-03 ... 6.87158514e-04
-1.88211525e-04 8.06324884e-05]
[-2.73241239e-03 -4.82351196e-04 -8.82360872e-04 ... 6.93345613e-04
9.29056292e-05 4.35279518e-04]
[-2.74020293e-03 -2.22056154e-04 -1.45526338e-03 ... 1.00860143e-03
6.22285670e-04 1.29442938e-03]]
ERROR:root:[[ 2.80307857e-03 -7.92506849e-04 -4.62006579e-04 ... 5.48897836e-04
-4.46117253e-04 -5.87294109e-04]
[ 2.80307857e-03 -4.22060822e-04 -5.62269660e-04 ... -1.11471560e-04
-8.69961090e-04 1.05912137e-03]
[ 2.80307857e-03 -8.39866791e-04 6.06816683e-05 ... -5.34630419e-04
8.54067104e-05 -4.98222078e-04]
...
[ 2.80307857e-03 2.86133521e-04 -1.37655462e-03 ... 6.87158514e-04
-1.88211525e-04 8.06324884e-05]
[ 2.80307857e-03 -4.82351196e-04 -8.82360872e-04 ... 6.93345613e-04
9.29056292e-05 4.35279518e-04]
[ 2.80307857e-03 -2.22056154e-04 -1.45526338e-03 ... 1.00860143e-03
6.22285670e-04 1.29442938e-03]]
ValueError Traceback (most recent call last)
Cell In[124], line 1
----> 1 g.fit(n_states=10, cluster_key="leiden")
2 g.plot_macrostates(which="all")
File ~/scratch/conda/envs/cr/lib/python3.10/site-packages/cellrank/estimators/terminal_states/_gpcca.py:563, in GPCCA.fit(self, n_states, n_cells, cluster_key, **kwargs)
560 n = n_states if isinstance(n_states, int) else max(n_states)
561 # call explicitly since
compute_macrostatesdoesn't handle the case562 # when
minChiis used forn_statesandself._gpccais uninitialized--> 563 _ = self.compute_schur(n, **kwargs)
564 return self.compute_macrostates(n_states=n_states, cluster_key=cluster_key, n_cells=n_cells)
File ~/scratch/conda/envs/cr/lib/python3.10/site-packages/cellrank/estimators/mixins/decomposition/_schur.py:175, in SchurMixin.compute_schur(self, n_components, initial_distribution, method, which, alpha, verbose)
173 with (contextlib.nullcontext if verbose else contextlib.redirect_stdout)(io.StringIO()):
174 try:
--> 175 self._gpcca._do_schur_helper(n_components)
176 except ValueError as e:
177 if "will split complex conjugate eigenvalues" not in str(e):
File ~/.local/lib/python3.10/site-packages/pygpcca/_gpcca.py:853, in GPCCA._do_schur_helper(self, m)
851 logging.info("Using pre-computed Schur decomposition")
852 else:
--> 853 self._p_X, self._p_R, self._p_eigenvalues = _do_schur(
854 self._P, eta=self._eta, m=m, z=self._z, method=self._method
855 )
File ~/.local/lib/python3.10/site-packages/pygpcca/_gpcca.py:260, in _do_schur(P, eta, m, z, method, tol_krylov)
258 if not np.allclose(Q.T.dot(Q * eta[:, None]), np.eye(Q.shape[1]), rtol=1e6 * EPS, atol=1e6 * EPS):
259 logging.debug("The Schur vectors aren't D-orthogonal so they are D-orthogonalized.")
--> 260 Q = _gram_schmidt_mod(Q, eta)
261 # Transform the orthonormalized Schur vectors of P_bar back
262 # to orthonormalized Schur vectors X of P.
263 X = np.true_divide(Q, np.sqrt(eta)[:, None])
File ~/.local/lib/python3.10/site-packages/pygpcca/_gpcca.py:138, in _gram_schmidt_mod(X, eta)
136 logging.error(Xc)
137 logging.error(X)
--> 138 raise ValueError(
139 "The subspace of Q derived by shifting a non-constant first (Schur)vector "
140 "to the right and setting the first (Schur) vector equal sqrt(eta) doesn't "
141 f"match the subspace of the original Q! The subspace angles are: {dummy}. "
142 f"Number of clusters: {m}."
143 )
145 # eta-orthonormalization
146 for j in range(m):
ValueError: The subspace of Q derived by shifting a non-constant first (Schur)vector to the right and setting the first (Schur) vector equal sqrt(eta) doesn't match the subspace of the original Q! The subspace angles are: [4.25185999e-02 1.14932390e-15 9.37777881e-16 8.45425796e-16
7.22915320e-16 6.54656692e-16 5.69987291e-16 4.62224178e-16
3.73019087e-16 3.32898212e-16]. Number of clusters: 10.`
cr.logging.print_versions()cellrank==2.0.0 scanpy==1.9.3 anndata==0.9.2 numpy==1.24.4 numba==0.57.1 scipy==1.11.1 pandas==1.5.3 pygpcca==1.0.4 scikit-learn==1.3.0 statsmodels==0.14.0 python-igraph==0.10.8 scvelo==0.2.5 pygam==0.8.0 matplotlib==3.7.0 seaborn==0.12.2Beta Was this translation helpful? Give feedback.
All reactions