Skip to main content

Module eval

Module eval 

Source
Expand description

Link prediction evaluation with filtered ranking.

Computes MRR and Hits@k in the filtered setting: for each test triple (h, r, t), rank all entities as head replacements and tail replacements, excluding other known-true triples from the ranking.

“Filtered” means that when computing the rank of a correct entity, we remove all other entities that also form known-true triples from the candidate set. This prevents penalizing a model for ranking another correct answer above the target. See Bordes et al. (2013) for the original protocol.

§Tie-breaking

This implementation uses pessimistic tie-breaking: an entity with the same score as the target does not increase the rank. Only entities with strictly better (lower) scores count. This is equivalent to “best-case rank among tied entities.”

§Parallelism

Evaluation is parallelized across test triples via rayon. Each test triple is scored independently against all entities.

Structs§

EvalResult
Evaluation results with optional per-relation breakdown.
Metrics
Link prediction metrics.

Functions§

evaluate_link_prediction
Evaluate link prediction on test triples in the filtered setting.
evaluate_link_prediction_detailed
Evaluate link prediction with per-relation breakdown.