Skip to content

GPCCA for matrix with absorbing states #6

Description

@Marius1311

Hi @msmdev , I have a large, reducible matrix with 5 recurrent and a number of transient states. I run GPCCA on it, both with method brandts as well as krylov_schur. In both cases, I get the following error:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-96-a7b1ed0126a1> in <module>
----> 1 gp.compute_metastable_states(n_states=5, method='brandts')
      2 gp.plot_metastable_states()

~/Projects/cellrank/cellrank/tools/estimators/_gppca.py in compute_metastable_states(self, n_states, initial_distribution, use_min_chi, method, which, n_cells, cluster_key, en_cutoff, p_thresh)
    371             start = logg.info("Computing metastable states")
    372 
--> 373             gpcca = gpcca.optimize(m=n_states)
    374 
    375             # when `n_cells!=None` and the overlap is high, we're skipping some metastable states

~/Projects/msmtools/msmtools/analysis/dense/gpcca.py in optimize(self, m, return_extra)
   1335         # Calculate Schur matrix R and Schur vector matrix X, if not adequately given.
   1336 
-> 1337         self._do_schur_helper(max(m_list))
   1338 
   1339         # Initialize lists to collect results.

~/Projects/msmtools/msmtools/analysis/dense/gpcca.py in _do_schur_helper(self, m)
   1137                     self.X, self.R = _do_schur(self.P, self.eta, m, self.z, self.method)
   1138             else:
-> 1139                 self.X, self.R = _do_schur(self.P, self.eta, m, self.z, self.method)
   1140 
   1141     def minChi(self, m_min, m_max):

~/Projects/msmtools/msmtools/analysis/dense/gpcca.py in _do_schur(P, eta, m, z, method, tol_krylov)
    300         # TODO @Marius: I'd decrease the tolerance, getting error here for 3+ MS states
    301         print(X.conj().T.dot(np.diag(eta)).dot(X))
--> 302         raise ValueError("Schur vectors appear to not be D-orthogonal.")
    303     # Raise, if X doesn't fullfill the invariant subspace condition!
    304 

ValueError: Schur vectors appear to not be D-orthogonal.

The deviations from the unit matrix are quite large (~1e-1), so this is not a tolerance problem. Would you expect the current implementation to run on reducible matrices? I remember you had some handling for this case in PCCA.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions