maxfuse.metrics.get_knn_alignment_score
- maxfuse.metrics.get_knn_alignment_score(dist, k_max, true_matching='identity')[source]
For each 1 <= k <= k_max, obtain knn matching from dist, and compute its matching proximity with the true matching. The proximity is calculated by: for each cell in arr1, claim it is successfully matched when the true match is in the k-nearest-neighborhood; then calculate the average success rate.
- Parameters:
dist (np.ndarray of shape (n1, n2)) – Distance matrix.
k_max (int) – Maximum k for knn matching.
true_matching ('identity' or Iterable of length n1, default='identity') – If is a list, then the ground truth matched pairs are (i, true_matching[i]) If is ‘identity’, then true_matching = [0, 1…, n1].
- Returns:
np.ndarray of shape (k_max,) representing the score for each 1<=k<=k_max.