PlanetAlign.metrics

hits_ks_scores

Hits@K scores of pairwise alignment results.

mrr_score

Mean Reciprocal Rank (MRR) score of pairwise alignment results.

Utility package for computing evaluation metrics for network aligment.

hits_ks_scores(simiarity: Tensor, test_pairs: Tensor, ks: list[int] | tuple[int, ...] = (1, 10, 30, 50), mode: str = 'mean') dict[int, float][source]

Hits@K scores of pairwise alignment results.

Parameters:
  • simiarity (torch.Tensor) – Similarity matrix of shape (n1, n2) where n1 and n2 are the number of nodes in graph1 and graph2.

  • test_pairs (torch.Tensor) – Test pairs of shape (m, 2) where m is the number of test pairs.

  • ks (list[int] or tuple[int, ...], optional) – List of k values for Hits@K scores. Default is (1, 10, 30, 50).

  • mode (str, optional) – Mode for Hits@K scores. Options are ‘mean’, ‘max’, ‘ltr’ (left-to-right), ‘rtl’ (right-to-left). Default is ‘mean’.

mrr_score(similarity: Tensor, test_pairs: Tensor, mode: str = 'mean') float[source]

Mean Reciprocal Rank (MRR) score of pairwise alignment results.

Parameters:
  • similarity (torch.Tensor) – Similarity matrix of shape (n1, n2) where n1 and n2 are the number of nodes in graph1 and graph2.

  • test_pairs (torch.Tensor) – Test pairs of shape (m, 2) where m is the number of test pairs.

  • mode (str, optional) – Mode for MRR score. Options are ‘mean’, ‘max’, ‘ltr’ (left-to-right), ‘rtl’ (right-to-left). Default is ‘mean’.