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

ValueError: At least one label specified must be in y_true #36

Open
tina-roostaei opened this issue Jun 21, 2020 · 4 comments
Open

ValueError: At least one label specified must be in y_true #36

tina-roostaei opened this issue Jun 21, 2020 · 4 comments

Comments

@tina-roostaei
Copy link

tina-roostaei commented Jun 21, 2020

Hi, I have converted my Seurat object integrated assay using SeuratDisk to anndata format, and want to run SCCAF. Data is loaded with no error using sc.read. However, when I run SCCAF_optimize_all I get the following warning and error:

anaconda3/lib/python3.7/site-packages/sklearn/metrics/classification.py:261: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
if np.all([l not in y_true for l in labels]):

ValueError: At least one label specified must be in y_true

It seems that the seurat cluster IDs (numbers starting from 0) are treated as scalar.
I was wondering if there is any solution on how to solve this and get the SCCAF_optimize_all to run.
Thanks

@camerongw
Copy link

I have had the same issue, also using Seurat-generated clusters. It'd be excellent to get a solution.

@mamtagiri
Copy link

HI guys,
Do we have a solution for this figured? I get the same error.

mamta

@mamtagiri
Copy link

here is the solution:

a.obs['seurat_clusters'] = a.obs.seurat_clusters.astype('object')

@achamess
Copy link

achamess commented Jul 9, 2021

I also had this problem. Recasting to dtype 'object' did not work. For me, I needed to recast to dtype 'str' and then it worked

adata.obs['L1_Round0'] = adata.obs['RNA_snn_res.2']
adata.obs['L1_Round0'] = adata.obs['L1_Round0'].astype('str')

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

4 participants