xchrom.tl.calc_auc_pr
- xchrom.tl.calc_auc_pr(true_matrix: array, pred_matrix: array, mtype: Literal['overall', 'percell', 'perpeak'] = 'overall') dict[source]
Calculate the AUROC and AUPRC metrics for given true and predicted matrix. Shape of true_matrix and pred_matrix must be consistent, cells x peaks.
- Parameters:
true_matrix (np.array) – The true label matrix (cells x peaks), 0/1 matrix, 0 for no signal, 1 for peak signal.
pred_matrix (np.array,) – The predicted probability matrix (cells x peaks), 0-1 matrix for peak signal.
mtype (Literal['overall', 'percell', 'perpeak'] = 'overall') – The type of metric to calculate, optional ‘overall’, ‘percell’, ‘perpeak’
Examples
>>> auc, prc = calc_auc_pr(true_matrix, pred_matrix, mtype='overall') >>> print(f"The AUROC is {auc:.4f}, The AUPRC is {prc:.4f}")