In enterprise web directories, entity taxonomy structures cannot rely solely on keyword token matching or static category trees. Complex real-world knowledge graphs contain millions of multi-relational triples $(h, r, t)$ exhibiting 1-to-N, N-to-1, and N-to-N relationships (e.g. "isA", "subCategoryOf", "locatedIn"). Traditional translational distance models like TransE ($h + r \approx t$) collapse when mapping reflexivity and many-to-one entity clusters. By upgrading knowledge base representation to TransH (Translational Hyperplanes) and TransR, directory indexing systems achieve precise entity disambiguation, robust link prediction, and sub-millisecond semantic entity search.
The Geometry of TransE vs TransH Hyperplane Projections
TransH projects head and tail entities onto a relation-specific hyperplane before vector translation:
For each relation $r$ characterized by normal vector $w_r$ and translation $d_r$, entity embeddings are projected as $h_{\perp} = h - w_r^T h w_r$ and $t_{\perp} = t - w_r^T t w_r$. The score function $f_r(h,t) = ||h_{\perp} + d_r - t_{\perp}||_2^2$ enables distinct representations for an entity across different semantic relations.
Knowledge Graph Embedding Models Comparison Matrix
| Model | Score Function | 1-to-N / N-to-1 Mapping | Parameter Complexity |
|---|---|---|---|
| TransE | ||h + r - t|| | Flawed (Forces identical embeddings) | O(N_e * d + N_r * d) |
| TransH (Hyperplane) | ||h_perp + d_r - t_perp|| | Resolved via Normal Vector Projections | O(N_e * d + 2 * N_r * d) |
| TransR (Relation Space) | ||M_r*h + r - M_r*t|| | Full Projection Matrix Mapping | O(N_e * d + N_r * k * d) |
TransH Hyperplane Projection & Distance Scorer in TypeScript
Compute triple plausibility scores with normalized hyperplane projections:
export function computeTransHScore(h: number[], wr: number[], dr: number[], t: number[]): number {
// 1. Calculate dot products: w_r^T * h and w_r^T * t
const dotH = h.reduce((sum, val, i) => sum + val * wr[i], 0);
const dotT = t.reduce((sum, val, i) => sum + val * wr[i], 0);
// 2. Project onto relation hyperplane
const hPerp = h.map((val, i) => val - dotH * wr[i]);
const tPerp = t.map((val, i) => val - dotT * wr[i]);
// 3. Compute L2 distance: ||hPerp + dr - tPerp||^2
let l2Distance = 0;
for (let i = 0; i < h.length; i++) {
const diff = hPerp[i] + dr[i] - tPerp[i];
l2Distance += diff * diff;
}
return l2Distance; // Lower score indicates higher semantic plausibility
}
Discover Directory Entities & Semantic Graphs
Navigate structured link taxonomies and connected data networks. Read our guide on Cross-Lingual Entity Linking & Wikibase Synsets, examine multi-region database sharding on CreativeWeb Sharding, review multi-currency Lombard lending at FinanceQuickly Wealth, or submit an entity to our directory graph.