dylkot / cNMF

Code and example data for running Consensus Non-negative Matrix Factorization on single-cell RNA-Seq data
MIT License
243 stars 57 forks source link

H should have the same dtype as X. Got H.dtype = float64. #66

Closed ryanhchung closed 10 months ago

ryanhchung commented 1 year ago

Hi,

I encountered the error shown in the title while performing consensus.

As suggested in #10, I edited the _check_w_h function in my conda environment, saved and performed it again, but still not fixed.

Anyone can help me solve it?

The code I edited is as follows: if there are any mistakes, please let me know

elif not update_H:
            _check_init(H, (self._n_components, n_features), "NMF (input H)")
            H = H.astype(np.float64)
            if H.dtype != X.dtype:
                raise TypeError(
                    "H should have the same dtype as X. Got H.dtype = {}.".format(
                        H.dtype
                    )
                )
lucas-diedrich commented 11 months ago

It might help to update anndata to version >0.9 in your python environment (see #71)

ryanhchung commented 10 months ago

Thanks! Everything worked after updating every dependencies :)