predict_target
- predict_target(model: Model, *, head: None | int | str = None, relation: None | int | str = None, tail: None | int | str = None, triples_factory: TriplesFactory | None = None, targets: None | Tensor | Sequence[int | str] = None, mode: Literal['training', 'validation', 'testing'] | None = None) Predictions [source]
Get predictions for the head, relation, and/or tail combination.
Note
Exactly one of head, relation and tail should be None. This is the position which will be predicted.
- Parameters:
model (Model) – A PyKEEN model
head (None | int | str) – the head entity, either as ID or as label. If None, predict heads
relation (None | int | str) – the relation, either as ID or as label. If None, predict relations
tail (None | int | str) – the tail entity, either as ID or as label. If None, predict tails
targets (None | Tensor | Sequence[int | str]) – restrict prediction to these targets. None means no restriction, i.e., scoring all entities/relations.
triples_factory (TriplesFactory | None) – the training triples factory; required if head/relation/tail are given as string, and used to translate the label to an ID.
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:
The predictions, containing either the \(k\) highest scoring targets, or all targets if \(k\) is None.
- Return type: