NormBasedInteraction

class NormBasedInteraction(p, power_norm=False)[source]

Bases: FunctionalInteraction, Generic[HeadRepresentation, RelationRepresentation, TailRepresentation], ABC

Norm-based interactions use a (powered) \(p\)-norm in their scoring function.

Initialize the norm-based interaction function.

Parameters
  • p (int) – The norm used with torch.linalg.vector_norm(). Typically is 1 or 2.

  • power_norm (bool) – Whether to use the p-th power of the \(L_p\) norm. It has the advantage of being differentiable around 0, and numerically more stable.