ClassificationEvaluator
- class ClassificationEvaluator(**kwargs)[source]
Bases:
Evaluator
An evaluator that uses a classification metrics.
Initialize the evaluator.
- Parameters
kwargs – keyword-based parameters passed to
Evaluator.__init__()
.
Methods Summary
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
- process_scores_(hrt_batch, target, scores, true_scores=None, dense_positive_mask=None)[source]
Process a batch of triples with their computed scores for all entities.
- Parameters
hrt_batch (
LongTensor
) – shape: (batch_size, 3)target (
Literal
[‘head’, ‘relation’, ‘tail’]) – the prediction targetscores (
FloatTensor
) – shape: (batch_size, num_entities)true_scores (
Optional
[FloatTensor
]) – shape: (batch_size, 1)dense_positive_mask (
Optional
[FloatTensor
]) – shape: (batch_size, num_entities) An optional binary (0/1) tensor indicating other true entities.
- Return type