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

UFuncTypeError #28

Open
HYJ-hh opened this issue May 9, 2023 · 4 comments
Open

UFuncTypeError #28

HYJ-hh opened this issue May 9, 2023 · 4 comments

Comments

@HYJ-hh
Copy link

HYJ-hh commented May 9, 2023

我在用sample data运行时

contingency matrix for query dataset

y_true = obs['celltype'][obs_ids2].values
y_pred = obs['predicted'][obs_ids2].values

ax, contmat = pl.plot_contingency_mat(
y_true, y_pred, norm_axis=1,
order_rows=False, order_cols=False,
)
pl._save_with_adjust(ax.figure, figdir / 'contingency_mat.png')
ax.figure
出现这样的错误:

UFuncTypeError Traceback (most recent call last)
Cell In[23], line 5
2 y_true = obs['celltype'][obs_ids2].values
3 y_pred = obs['predicted'][obs_ids2].values
----> 5 ax, contmat = pl.plot_contingency_mat(
6 y_true, y_pred, norm_axis=1,
7 order_rows=False, order_cols=False,
8 )

File ~/miniconda3/envs/env_came/lib/python3.8/site-packages/came/utils/plot.py:253, in plot_contingency_mat(y_true, y_pred, norm_axis, arrange, order_rows, order_cols, ax, figsize, fp, **kwds)
251 """function for plotting the contingency matrix"""
252 from .analyze import wrapper_contingency_mat
--> 253 contmat = wrapper_contingency_mat(
254 y_true, y_pred, normalize_axis=norm_axis,
255 order_rows=order_rows, order_cols=order_cols, )
256 if arrange:
257 # align column- and row- names as possible
258 from .analyze import arrange_contingency_mat

File ~/miniconda3/envs/env_came/lib/python3.8/site-packages/came/utils/analyze.py:1677, in wrapper_contingency_mat(y_true, y_pred, order_rows, order_cols, normalize_axis, as_df, eps, assparse)
1675 mat = mat + eps
1676 if normalize_axis is not None: # 0 for columns
-> 1677 mat = pp.normalize_norms(mat, axis=normalize_axis)
1679 if as_df:
1680 mat = pd.DataFrame(mat, index=classes, columns=clusters)

File ~/miniconda3/envs/env_came/lib/python3.8/site-packages/came/utils/preprocess.py:1619, in normalize_norms(X, scale_factor, axis, by)
1603 """ wrapper of normalize_colsum and normalize_rowsum
1604
1605 Parameters
(...)
1616
1617 """
1618 foo = normalize_col if axis == 0 else normalize_row
-> 1619 return foo(X, scale_factor=scale_factor, by=by)

File /miniconda3/envs/env_came/lib/python3.8/site-packages/came/utils/preprocess.py:1585, in normalize_row(X, scale_factor, by)
1583 is_zero = norms == 0
1584 scale_factor = np.median(norms[
is_zero])
-> 1585 norms /= scale_factor
1586 # for those rows or columns that summed to 0, just do nothing
1587 norms[norms == 0] = 1

UFuncTypeError: Cannot cast ufunc 'true_divide' output from dtype('float64') to dtype('int64') with casting rule 'same_kind'

请问怎么解决呀

@jxxll
Copy link

jxxll commented Jun 5, 2023

Hi, I have met the same issue recently. Have you find the method to solve the problems?

@HYJ-hh
Copy link
Author

HYJ-hh commented Jun 5, 2023

not yet~

@XingyanLiu
Copy link
Owner

Apologies for the delay in responding. The bug-fixed version of CAME will be released prior to 6.12.

@HYJ-hh
Copy link
Author

HYJ-hh commented Jun 5, 2023

thanks, I will be looking forward to it until then

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

3 participants