- predict_triples_df(model, *, triples, triples_factory=None, batch_size=None, mode=None)
Predict on labeled or mapped triples.
Model) – The model.
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.
- Return type
columns: head_id | relation_id | tail_id | score | * A dataframe with one row per triple.
ValueError – If label-based triples have been provided, but the triples factory does not provide a mapping.
The TransE model can be trained and used to predict a given triple.
>>> from pykeen.pipeline import pipeline >>> result = pipeline(dataset="nations", model="TransE") >>> from pykeen.models.predict import predict_triples_df >>> df = predict_triples_df( ... model=result.model, ... triples=("uk", "conferences", "brazil"), ... triples_factory=result.training, ... )