Skip to content

LinkPredMRR

LinkPredMRR(k: int)

Bases: LinkPredMetric

MRR @ \(k\) (Mean Reciprocal Rank): the reciprocal rank of the first relevant item of the top-\(k\), or zero.

Parameters:

Name Type Description Default
k int

The number of top-\(k\) predictions to evaluate against.

required
Source code in mlx_graphs/metrics/link_pred.py
def __init__(self, k: int):
    if k <= 0:
        raise ValueError(
            f"'k' needs to be a positive integer in "
            f"'{self.__class__.__name__}' (got {k})"
        )
    self.k = k
    self.reset()

from mlx_graphs.metrics import LinkPredMRR · mlx_graphs/metrics/link_pred.py