predict_target
- predict_target(model, *, head=None, relation=None, tail=None, triples_factory=None, targets=None, mode=None)[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 modelhead (
Union
[None
,int
,str
]) – the head entity, either as ID or as label. If None, predict headsrelation (
Union
[None
,int
,str
]) – the relation, either as ID or as label. If None, predict relationstail (
Union
[None
,int
,str
]) – the tail entity, either as ID or as label. If None, predict tailstargets (
Union
[None
,LongTensor
,Sequence
[Union
[int
,str
]]]) – restrict prediction to these targets. None means no restriction, i.e., scoring all entities/relations.triples_factory (
Optional
[TriplesFactory
]) – the training triples factory; required if head/relation/tail are given as string, and used to translate the label to an ID.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.
- Return type:
- Returns:
The predictions, containing either the \(k\) highest scoring targets, or all targets if \(k\) is None.