Semantic Regions
HNSW as Hierarchical Clustering
Section titled “HNSW as Hierarchical Clustering”HNSW builds a multi-level graph where each level has fewer, more “central” nodes. These hubs emerge naturally and act as unsupervised cluster centroids. CVX assigns every node to its nearest hub via greedy descent — regions at level .
💡 No training required
Unlike k-means or DBSCAN, HNSW regions emerge from index construction. No hyperparameter tuning, no iterative optimization. O(N) single-pass assignment.
import chronos_vector as cvximport numpy as npnp.random.seed(42)
index = cvx.TemporalIndex(m=4, ef_construction=50, ef_search=50)for cluster in range(3): center = np.random.randn(16).astype(np.float32) * 2 for entity in range(10): for t in range(20): drift = np.random.randn(16).astype(np.float32) * 0.1 * t vec = center + drift + np.random.randn(16).astype(np.float32) * 0.3 index.insert(cluster * 100 + entity, t * 86400, vec.tolist())print(f"Index: {len(index)} points")Index: 600 pointsRegion Discovery and Purity
Section titled “Region Discovery and Purity”assignments = index.region_assignments(level=1)for hub_id, members in sorted(assignments.items(), key=lambda x: -len(x[1]))[:3]: clusters = {} for eid, ts in members: clusters[eid // 100] = clusters.get(eid // 100, 0) + 1 dominant = max(clusters.values()) print(f" Hub {hub_id}: {len(members)} members, purity={dominant/len(members):.0%}") Hub 38: 32 members, purity=100% Hub 161: 28 members, purity=100% Hub 301: 26 members, purity=100%Region Trajectory (EMA-Smoothed)
Section titled “Region Trajectory (EMA-Smoothed)”Track membership evolution with exponential smoothing:
Distributional Distances
Section titled “Distributional Distances”Compare region distributions with geometry-aware metrics:
| Metric | Formula | Range |
|---|---|---|
| Fisher-Rao | ||
| Hellinger | ||
| Wasserstein | Optimal transport with region centroids |