sccaf icon indicating copy to clipboard operation
sccaf copied to clipboard

ValueError: At least one label specified must be in y_true

Open tina-roostaei opened this issue 4 years ago • 4 comments

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

tina-roostaei avatar Jun 21 '20 04:06 tina-roostaei

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

camerongw avatar Jun 30 '20 00:06 camerongw

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

mamta

mamtagiri avatar Mar 15 '21 16:03 mamtagiri

here is the solution:

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

mamtagiri avatar Mar 15 '21 17:03 mamtagiri

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')

achamess avatar Jul 09 '21 16:07 achamess