Expand description
Link prediction: rank candidate entities for an incomplete triple, and the
standard ranking metrics (mean rank, MRR, Hits@k). This is the cheap, always-on
path — given a trained EmbeddingTable, answer “which tail best completes
(h, r, ?)” by scoring candidates and ranking by plausibility.
Enums§
- Rank
Filter - Whether to use the filtered ranking protocol (Bordes et al. 2013): known-true triples other than the target are removed from the candidate set before ranking, so a model is not penalised for ranking another genuine answer above the target.
Functions§
- hits_
at_ k - Hits@k — fraction of test triples whose true tail ranks within the top
k. - mean_
rank - Mean rank over a set of
(h, r, t)test triples, each ranked againstcandidates(typically all entities). Lower is better. - mean_
reciprocal_ rank - Mean reciprocal rank (MRR) —
mean(1/rank). Higher is better, in(0, 1]. - rank_
tail - Rank of the true tail
tamongcandidatesfor(h, r, ?). Rank 1 is best. The rank is1 + (#candidates scoring strictly higher than the true tail); ties are broken pessimistically by also counting equal-scoring different candidates at half weight is avoided — we use the strict-greater convention (optimistic ties), which is the common reporting choice. Fails closed on bad indices.