You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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'
请问怎么解决呀
The text was updated successfully, but these errors were encountered:
我在用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
andnormalize_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)is_zero])1583 is_zero = norms == 0
1584 scale_factor = np.median(norms[
-> 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'
请问怎么解决呀
The text was updated successfully, but these errors were encountered: