Skip to contents

A real bilinear model must either be symmetric, losing antisymmetric relations, or full, costing d^2 parameters. ComplEx moves to complex vectors and takes the real part of a Hermitian product; conjugating the tail breaks the symmetry while the parameter count stays linear.

Usage

Comple(
  triples,
  dim,
  re_e = NULL,
  im_e = NULL,
  re_r = NULL,
  im_r = NULL,
  seed = 1
)

Arguments

triples

Matrix of zero-based [head, relation, tail] indices.

dim

Embedding dimension.

re_e, im_e

Entity embeddings, optional.

re_r, im_r

Relation embeddings, optional.

seed

Seed for the shared Lehmer minstd default embeddings.

Value

List with estimate, scores, m, dim.

Details

Formula: Re(<e_h, w_r, conj(e_t))> = sum_k [Rh Rr Rt + Rh Ir It + Ih Rr It - Ih Ir Rt].

References

Trouillon, T. et al. (2016). Complex embeddings for simple link prediction. ICML 33, 2071-2080, equation (11).

Examples

triples <- matrix(c(1L, 1L, 2L, 2L, 1L, 3L, 3L, 2L, 1L), ncol = 3, byrow = TRUE)
Comple(triples, dim = 4)
#> $estimate
#> [1] -1.414374
#> 
#> $scores
#> [1] -6.5058255  2.5490568 -0.2863525
#> 
#> $m
#> [1] 3
#> 
#> $dim
#> [1] 4
#> 
#> $method
#> [1] "ComplEx triple score"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"