Skip to content

Error for clf.fit #158

@AdotaLover

Description

@AdotaLover

Hi!Thank you for your tool!
But when i execute this commend
doublets = clf.fit(adata.X).predict(p_thresh=1e-16, voter_thresh=0.5)
an error below:
{
"name": "AttributeError",
"message": "'csr_matrix' object has no attribute 'A'",
"stack": "---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[37], line 1
----> 1 adatas_pp = [pp(ad) for ad in adatas]

Cell In[37], line 1, in (.0)
----> 1 adatas_pp = [pp(ad) for ad in adatas]

Cell In[36], line 11, in pp(adata)
9 adata.uns['cells_removed'] = sum(bool_vector)
10 # 检测双重细胞
---> 11 doublets = clf.fit(adata.X).predict(p_thresh=1e-16, voter_thresh=0.5)
12 doublet_score = clf.doublet_score()
13 # 保存双重细胞信息

File ~/miniconda3/envs/scanpy/lib/python3.10/site-packages/doubletdetection/doubletdetection.py:208, in BoostClassifier.fit(self, raw_counts)
206 if self.verbose:
207 print("Iteration {:3}/{}".format(i + 1, self.n_iters))
--> 208 self.all_scores_[i], self.all_log_p_values_[i] = self.one_fit()
209 all_communities[i] = self.communities

210 all_parents.append(self.parents_)

File ~/miniconda3/envs/scanpy/lib/python3.10/site-packages/doubletdetection/doubletdetection.py:308, in BoostClassifier._one_fit(self)
306 scaled_aug_counts = aug_counts * np.median(aug_lib_size)
307 if self.pseudocount != 1:
--> 308 aug_counts = np.log(scaled_aug_counts.A + 0.1)
309 else:
310 aug_counts = np.log1p(scaled_aug_counts)

AttributeError: 'csr_matrix' object has no attribute 'A'"
}
But your update shows that it supports csr_matrix!Looking foward to your reply!Thanks!

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