predict_all

predict_all(model, *, k=None, batch_size=1, mode=None, target='tail')[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 (Optional[int]) – The number of triples to return. Set to None to keep all.

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

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

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

Return type:

ScorePack

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