Skip to content

LinkPredPersonalization

LinkPredPersonalization(
    k: int, max_src_nodes: Optional[int] = 2**12, batch_size: int = 2**16
)

Bases: _LinkPredMetric

Personalization @ \(k\): the dissimilarity of the recommendations of different examples (the average of 1 - overlap / k over all pairs of examples).

Parameters:

Name Type Description Default
k int

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

required
max_src_nodes Optional[int]

Maximum number of examples kept to compute the pairwise dissimilarity (None for all). Default: 2**12

2 ** 12
batch_size int

Number of pairs processed at once. Default: 2**16

2 ** 16
Source code in mlx_graphs/metrics/link_pred.py
def __init__(
    self, k: int, max_src_nodes: Optional[int] = 2**12, batch_size: int = 2**16
):
    self.max_src_nodes = max_src_nodes
    self.batch_size = batch_size
    super().__init__(k)

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