Closed WeilerP closed 3 years ago
@Marius1311 I think we could safely lower the negative threshold for chi here, mb. even down to 10e-12? What is your opinion on this?
Sure, agreed. @WeilerP, what value would we have to change the threshold to, so that this passes?
Sure, agreed. @WeilerP, what value would we have to change the threshold to, so that this passes?
I set EPS
to 1e-10
but didn't check at which bound it starts failing.
Sure, agreed. @WeilerP, what value would we have to change the threshold to, so that this passes?
I set
EPS
to1e-10
but didn't check at which bound it starts failing.
@WeilerP, were exactly did you set EPS
to 1e-10
?
Ah sorry, should have been more specific. I manually set EPS
in pygpcca/utils/_constants.py
and installed pyGPCCA from source in editable mode via pip install -e pyGPCCA
s.t. I could run the above code.
Ah sorry, should have been more specific. I manually set
EPS
inpygpcca/utils/_constants.py
and installed pyGPCCA from source in editable mode viapip install -e pyGPCCA
s.t. I could run the above code.
@WeilerP , it is not intended to manipulate EPS
in pygpcca/utils/_constants.py
.
This could have all kinds of unintended effects. Please revert this.
Could you please instead print out the actual values of chi
in _opt_soft(X, rot_matrix)
before the error is raised?
Thus, we can see what the actual negative elements are.
@WeilerP, is the issue still occurring? We are currently working on printing out the deviations in such cases, see #29 .
@msmdev, sorry for the delay. The issue seems to be numerical since I could not reproduce the error on a different machine. Will come back to it should the error pop up again. #29 should help investigate it further.
@WeilerP, alright - no problem! Come back anytime :) In the meantime we will try to make things more convenient.
Description
Using CellRank with pyGPCCA on an Arabidopsis single-cell dataset, the threshold determining if values are negative is too tight when computing the Schur decompositon.
Reproducible example
Traceback
```pytb --------------------------------------------------------------------------- ValueError Traceback (most recent call last) /code/cellrank/cellrank/tl/estimators/_gpcca.py in compute_macrostates(self, n_states, n_cells, use_min_chi, cluster_key, en_cutoff, p_thresh) 178 try: --> 179 self._gpcca = self._gpcca.optimize(m=n_states) 180 except ValueError as e: ~/miniconda3/envs/cellrank/lib/python3.8/site-packages/pygpcca/_gpcca.py in optimize(self, m) 1015 # Xm = np.copy(X[:, :m]) -> 1016 chi, rot_matrix, crispness = _gpcca_core(self._p_X[:, :m]) 1017 # check if we have at least m dominant sets. If less than m, we warn. ~/miniconda3/envs/cellrank/lib/python3.8/site-packages/pygpcca/_gpcca.py in _gpcca_core(X) 638 --> 639 rot_matrix, chi, fopt = _opt_soft(X, rot_matrix) 640 ~/miniconda3/envs/cellrank/lib/python3.8/site-packages/pygpcca/_gpcca.py in _opt_soft(X, rot_matrix) 518 if np.any(chi < -10 * EPS): --> 519 raise ValueError(f"Some elements of chi are significantly negative: < {-10 * EPS}.") 520 else: ValueError: Some elements of chi are significantly negative: < -2.220446049250313e-15. During handling of the above exception, another exception occurred: ValueError Traceback (most recent call last) ~/.ch_tmp/ipykernel_27625/1301213408.py in