consume_scores(model, dataset, *consumers, batch_size=1, mode=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.

  • 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 (Optional[Literal[‘training’, ‘validation’, ‘testing’]]) – The pass mode, which is None in the transductive setting and one of “training”, “validation”, or “testing” in the inductive setting.


ValueError – if no score consumers are given

Return type: