grassp.tl.annotation_f1_score

grassp.tl.annotation_f1_score#

annotation_f1_score(data, gt_col, pred_col, weights=None, average='macro')[source]#

F1 score of a predicted annotation against ground-truth labels.

Works for any annotator: it compares two .obs columns and has no notion of how the prediction was produced.

Parameters:
data

AnnData object.

gt_col

Observation column with ground-truth labels.

pred_col

Observation column with predicted labels, e.g. "competitive_diffusion" or "svm_annotation".

weights default: None

Weights for the F1 score.

average default: 'macro'

Average method for the F1 score. If None the score for each label is returned.

Returns:

F1 score.