liveBook · Manning

Knowledge graph embedding

As explained in Graph Algorithms for Data Science

A knowledge graph embedding model maps knowledge graph entities and relationships into a low-dimensional vector space while preserving patterns expressed by valid triples.

Knowledge graph embedding maps entities and typed relationships in a heterogeneous graph into low-dimensional vectors. It uses directed triples—head, relation, tail—so relationship labels distinguish connection types, unlike approaches that encode only nodes. section 11.1.1 section 11.4

A triple such as Ana —LIVES_IN→ Paris records both endpoints and the relationship type. Triples support graphs with many entity and relationship types, although the embedding representation does not explicitly define node labels. section 11.1.1

TransE gives an intuitive embedding rule: for a valid triple, the head vector plus the relation vector should lie close to the tail vector (h + r ≈ t). Training favors this pattern for known triples and keeps nonexistent head–relation–tail combinations apart. section 11.1.2

Figure 11.6 TransE encoding intuition
11-06

Use the diagram to see a relationship represented as a vector translation from a head entity toward its tail entity. section 11.1.2

A practical completion workflow is:

  • Start with a rich knowledge graph containing known entities, relationships, and their types. section 11.2
  • Train an embedding model to encode entities and relationships, then rank likely missing links and their types. section 11.2
  • Treat predictions as candidates for review rather than approved conclusions. section 11.4

Drug repurposing

A biomedical graph of drugs, diseases, genes, pathways, and known treatments can be embedded to suggest new applications for aspirin. Supporting literature and existing graph paths help domain experts assess a prediction; clinical trials remain necessary for approval. section 11.2 section 11.2.5 section 11.4

How Graph Algorithms for Data Science covers it

How deep it goes
Explains triples and TransE’s vector objective, while deferring mathematical implementation details to the original article.
Examples
Uses Ana living in Paris and aspirin drug-repurposing predictions evaluated through biomedical literature and graph paths.
What it assumes
Introduces head, relation, and tail triples from zero without requiring prior graph-theory expertise.
What you can do after
Apply it via PyKEEN to rank potential new applications from a biomedical knowledge graph.
How it connects
Connects heterogeneous graphs, triples, TransE, multiclass link prediction, and knowledge graph completion.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Graph Algorithms for Data Science. The section links point to the parts of the book it draws on.