MacroRankBasedEvaluator
- class MacroRankBasedEvaluator(**kwargs)[source]
Bases:
RankBasedEvaluator
Macro-average rank-based evaluation.
Initialize the evaluator.
- Parameters:
kwargs – additional keyword-based parameters passed to
RankBasedEvaluator.__init__()
.
Methods Summary
clear
()Clear buffers and intermediate results.
finalize
()Compute the final results, and clear buffers.
process_scores_
(hrt_batch, target, scores[, ...])Process a batch of triples with their computed scores for all entities.
Methods Documentation
- finalize() RankBasedMetricResults [source]
Compute the final results, and clear buffers.
- Return type:
- process_scores_(hrt_batch: Tensor, target: Literal['head', 'relation', 'tail'], scores: Tensor, true_scores: Tensor | None = None, dense_positive_mask: Tensor | None = None) None [source]
Process a batch of triples with their computed scores for all entities.
- Parameters:
hrt_batch (Tensor) – shape: (batch_size, 3)
target (Literal['head', 'relation', 'tail']) – the prediction target
scores (Tensor) – shape: (batch_size, num_entities)
true_scores (Tensor | None) – shape: (batch_size, 1)
dense_positive_mask (Tensor | None) – shape: (batch_size, num_entities) An optional binary (0/1) tensor indicating other true entities.
- Return type:
None