ComplEx

class ampligraph.latent_features.layers.scoring.ComplEx(*args: Any, **kwargs: Any)

Complex Embeddings (ComplEx) scoring layer.

The ComplEx model [TWR+16] is an extension of the ampligraph.latent_features.DistMult bilinear diagonal model.

ComplEx scoring function is based on the trilinear Hermitian dot product in \(\mathbb{C}\):

\[f_{ComplEx}=Re(\langle \mathbf{r}_p, \mathbf{e}_s, \overline{\mathbf{e}_o} \rangle)\]

Note

Since ComplEx embeddings belong to \(\mathbb{C}\), this model uses twice as many parameters as ampligraph.latent_features.DistMult.

Attributes

class_params

external_params

name

Methods

__init__(k)

Initializes the scoring layer.

get_config()

__init__(k)

Initializes the scoring layer.

Parameters
  • k (int) – Embedding size.

  • max_rel_size (int) – This value specifies the number of relations in the KG. It is essential only for RotatE scoring layer (default: None).

get_config()