consume_scores

consume_scores(model: Model, dataset: PredictionDataset, *consumers: ScoreConsumer, batch_size: int = 1, mode: Literal['training', 'validation', 'testing'] | None = None) None[source]

Batch-wise calculation of all triple scores and consumption.

From a high-level perspective, this method does the following:

for batch in dataset:
    scores = model.predict(batch)
    for consumer in consumers:
        consumer(batch, scores)

By bringing custom prediction datasets and/or score consumers, this method is highly configurable.

Parameters:
  • model (Model) – the model used to calculate scores

  • dataset (PredictionDataset) – the dataset defining the prediction tasks, i.e., inputs to model.predict to loop over.

  • consumers (ScoreConsumer) – the consumers of score batches

  • batch_size (int) – The batch size to use. Will automatically be lowered, if the hardware cannot handle this large batch sizes.

  • mode (Literal['training', 'validation', 'testing'] | None) – The pass mode, which is None in the transductive setting and one of “training”, “validation”, or “testing” in the inductive setting.

Raises:

ValueError – if no score consumers are given

Return type:

None