predict_triples

predict_triples(model: Model, *, triples: None | Tensor | ndarray | tuple[str, str, str] | Sequence[tuple[str, str, str]], triples_factory: CoreTriplesFactory | None = None, batch_size: int | None = None, mode: Literal['training', 'validation', 'testing'] | None = None) ScorePack[source]

Predict on labeled or mapped triples.

Parameters:
  • model (Model) – The model.

  • triples (None | Tensor | ndarray | tuple[str, str, str] | Sequence[tuple[str, str, str]]) –

    shape: (num_triples, 3) The triples in one of the following formats:

    • A single label-based triple.

    • A list of label-based triples.

    • An array of label-based triples

    • An array of ID-based triples.

    • None. In this case, a triples factory has to be provided, and its triples will be used.

  • triples_factory (CoreTriplesFactory | None) – The triples factory. Must be given if triples are label-based. If provided and triples are ID-based, add labels to result.

  • batch_size (int | None) – The batch size to use. Use None to use the largest possible.

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

Returns:

a score pack of the triples with the predicted scores.

Return type:

ScorePack