预测_h_不确定性
- predict_h_uncertain(model: Model, rt_batch: Tensor, num_samples: int = 5, slice_size: int | None = None, *, mode: Literal['training', 'validation', 'testing'] | None = None) UncertainPrediction[source]
使用左侧(头部)预测进行前向传递,以获取所有可能头部的分数。
此方法为每个(关系,尾)对计算所有可能头部的得分,以及不确定性量化。
注意
如果模型已经用逆关系进行了训练,预测头实体的任务就变成了预测逆三元组的尾实体的任务,即\(f(*,r,t)\)通过\(f(t,r_{inv},*)\)来预测。
- Parameters:
- Returns:
形状: (batch_size, num_entities) 对于每个r-t对,所有可能头部的分数。
此函数通过使用
predict_uncertain_helper()委托给pykeen.models.Model.score_h()(或pykeen.models.Model.score_h_inverse()如果模型使用逆三元组)作为score_method。- Return type:
警告
此函数将模型设置为评估模式,并将所有dropout层设置为训练模式。