scanpy.metrics.confusion_matrix#
- scanpy.metrics.confusion_matrix(orig, new, data=None, *, normalize=True)[source]#
Given an original and new set of labels, create a labelled confusion matrix.
Parameters
orig
andnew
can either be entries in data or categorical arrays of the same size.- Parameters:
- Return type:
Examples
import scanpy as sc; import seaborn as sns pbmc = sc.datasets.pbmc68k_reduced() cmtx = sc.metrics.confusion_matrix("bulk_labels", "louvain", pbmc.obs) sns.heatmap(cmtx)