Skip to content

HPO2Vec

Marwan2505 edited this page Jul 13, 2026 · 1 revision

HPO2Vec+ Similarity Method

HPO2Vec+ learns dense vector embeddings for every HPO term and disease by training Word2Vec on IC-weighted random walks over a combined ontology and disease graph. Patient and disease profiles are each collapsed into a single embedding vector via IC-weighted averaging, and similarity is the cosine of the angle between them.


Pipeline Overview

Build graph → Generate IC-weighted walks → Train Word2Vec → Embed term sets → Cosine similarity

Step 1: Build the Graph

A single graph is built from two edge types:

  • IS-A edges (from hpo_parents.json): connect child HPO terms to their parents, bidirectionally. Allows walks to traverse up and down the ontology hierarchy.
  • HAS-PHENOTYPE edges (from disease_profiles.json): connect each disease to its raw HPO terms, bidirectionally. Allows walks to hop from a disease into its phenotypes and then up the hierarchy.

Raw HPO terms (not propagated) are used for HAS-PHENOTYPE edges because IS-A edges already capture the hierarchy — adding propagated terms would create redundant edges.


Step 2: IC-Weighted Random Walks

Walks are biased using Information Content and two structural parameters:

Transition Probabilities

For each step from current to a neighbour:

weight = IC(neighbour) × bias

Where bias depends on the walk history:

Condition | Bias | Effect -- | -- | -- First step (no history) | 1.0 | Uniform neighbour == previous | 1 / p | Penalizes backtracking neighbour is adjacent to previous | 1.0 | Neutral (distance-1) Otherwise | 1 / q | Controls DFS vs BFS exploration

Model Caching

Trained Word2Vec models are saved to model_cache/ so they don't need to be retrained on every run. The cache is keyed on the training configuration. Delete the cache to force retraining.

Clone this wiki locally