predict_hrt_uncertain
- predict_hrt_uncertain(model, hrt_batch, num_samples=5)[source]
Calculate the scores with uncertainty quantification via Monte-Carlo dropout.
- Parameters
- Return type
- Returns
shape: (number of triples, 1) The score for each triple, and an uncertainty score, where larger scores correspond to less certain predictions.
This function delegates to
predict_uncertain_helper()
by usingpykeen.models.Model.score_hrt()
as thescore_method
.
Warning
This function sets the model to evaluation mode and all dropout layers to training mode.
Example Usage:
from pykeen.pipeline import pipeline from pykeen.models.predict import predict_hrt_uncertain result = pipeline(dataset="nations", model="ERMLPE") prediction_with_uncertainty = predict_hrt_uncertain( model=result.model, hrt_batch=result.training.mapped_triples[0:8], )