Skip to content

Conversation

@AMMAS1
Copy link

@AMMAS1 AMMAS1 commented Nov 11, 2025

Add SimplE Knowledge Graph Embedding Model

Summary

Implements the SimplE model for knowledge graph embedding, addressing the independence issue in CP decomposition by leveraging inverse relations.

Changes

  • New model: torch_geometric.contrib.nn.SimplE - A bilinear KGE model that uses two embeddings per entity (head/tail) and two per relation (forward/inverse)
  • Scoring function: 0.5 * (⟨h_e, v_r, t_e⟩ + ⟨h_t, v_r⁻¹, t_h⟩) - Average of CP scores for forward and inverse relations
  • Example script: examples/contrib/simple_fb15k_237.py - Training example on FB15k-237 dataset

Files Changed

  • torch_geometric/contrib/nn/kge/simplE.py - SimplE model implementation
  • torch_geometric/contrib/nn/kge/__init__.py - Export SimplE
  • examples/contrib/simple_fb15k_237.py - Usage example
  • test/contrib/nn/kge/test_simple.py - Unit tests
  • CHANGELOG.md - Added entry under [Unreleased]

Implementation Details

  • Extends KGEModel base class following the same pattern as TransE and RotatE
  • Uses binary cross-entropy loss with logits (same as ComplEx)
  • Xavier uniform initialization for all embeddings

Testing

  • Ran the example on FB15k-237 dataset with successful training and evaluation
  • Results: MRR 0.1969, Hits@10 0.3627 after 5 epochs (improves with more training)

References

@AMMAS1 AMMAS1 marked this pull request as ready for review December 12, 2025 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants