← Lessons

quiz vs the machine

Platinum1870

Machine Learning

Knowledge Graph Embeddings

Represent entities and relations as vectors so facts become geometric operations.

6 min read · advanced · beat Platinum to climb

Facts as triples

A knowledge graph stores facts as triples: a head entity, a relation, and a tail entity, such as Paris located in France. The goal of knowledge graph embedding is to place entities and relations into a vector space so true triples score high and false ones score low.

The translation idea

The classic model TransE represents a relation as a translation vector. It wants the head vector plus the relation vector to land near the tail vector. So head plus relation approximately equals tail. Scoring a triple is then measuring how far head plus relation is from tail.

Other scoring families

  • Bilinear models like DistMult score a triple with a weighted product of head and tail through a relation matrix, good for symmetric relations.
  • Complex models like ComplEx use complex valued vectors to capture asymmetric relations such as parent of.
  • Rotation models like RotatE treat a relation as a rotation in complex space.

Training and use

Train with negative sampling: corrupt a true triple by swapping its head or tail and push its score down. The learned embeddings power link prediction to complete missing facts and enrich recommendation and search.

Key idea

Knowledge graph embeddings place entities and relations in a vector space so facts become geometric operations, scored to predict and complete missing triples.

Check yourself

Answer to earn rating on the learn ladder.

1. How does TransE represent a relation?

2. What is a triple in a knowledge graph?

3. How are knowledge graph embeddings typically trained?