predict_all

predict_all(model: Model, *, k: int | None = None, batch_size: int | None = 1, mode: Literal['training', 'validation', 'testing'] | None = None, target: Literal['head', 'relation', 'tail'] = 'tail') ScorePack[source]

Calculate scores for all triples, and either keep all of them or only the top k triples.

Parameters:
  • model (Model) – A PyKEEN model

  • k (int | None) – The number of triples to return. Set to None to keep all.

  • batch_size (int | None) – The batch size to use for calculating scores; set to None to determine largest possible batch size.

  • 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.

  • target (Literal['head', 'relation', 'tail']) – the prediction target to use. Prefer targets which are efficient to predict with the given model, e.g., tails for ConvE.

Returns:

A score pack of parallel triples and scores

Raises:

ValueError – if an inductive inference mode is selected, but the model does not support it

Return type:

ScorePack