PairRE交互
- class PairREInteraction(p: int, power_norm: bool = False)[源代码]
基础类:
NormBasedInteraction[Tensor,tuple[Tensor,Tensor],Tensor]基于无状态范数的PairRE交互函数。
它由以下给出
\[-\|\mathbf{h} \odot \mathbf{r}_h - \mathbf{t} \odot \mathbf{r}_t \|\]其中 \(\mathbf{h}, \mathbf{r}_h, \mathbf{r}_t, \mathbf{t} \in \mathbb{R}\) 分别表示头实体、关系特定的头投影、关系特定的尾投影和尾实体的表示。
注意
pykeen.models.PairRE另外强制 \(\|\mathbf{h}\| = \|\mathbf{t}\| = 1\)。初始化基于范数的交互函数。
- Parameters:
p (int) – 与
torch.linalg.vector_norm()一起使用的范数。通常为1或2。power_norm (bool) – 是否使用\(L_p\)范数的p次方。它的优点是在0附近可微分,并且在数值上更稳定。
属性摘要
关系表示的符号形状
方法总结
forward(h, r, t)评估交互函数。
属性文档
方法文档