UMInteraction

class UMInteraction(p: int, power_norm: bool = True)[source]

Bases: NormBasedInteraction[Tensor, None, Tensor]

A stateful module for the UnstructuredModel interaction function.

See also

pykeen.nn.functional.unstructured_model_interaction()

Initialize the interaction module.

Parameters:
  • p (int) – the \(p\) value of the norm to use, cf. NormBasedInteraction.__init__()

  • power_norm (bool) – whether to use the \(p`th power of the p-norm, cf. :meth:`NormBasedInteraction.__init__\).

Attributes Summary

relation_shape

The symbolic shapes for relation representations

Methods Summary

func(t, p[, power_norm])

Evaluate the SimplE interaction function.

Attributes Documentation

relation_shape: Sequence[str] = ()

The symbolic shapes for relation representations

Methods Documentation

func(t: Tensor, p: int, power_norm: bool = True) Tensor

Evaluate the SimplE interaction function.

Parameters:
  • h (Tensor) – shape: (*batch_dims, dim) The head representations.

  • t (Tensor) – shape: (*batch_dims, dim) The tail representations.

  • p (int) – The parameter p for selecting the norm.

  • power_norm (bool) – Whether to return the powered norm instead.

Returns:

shape: batch_dims The scores.

Return type:

Tensor