02. Clustering & Planar Simplex Projection
Deep dive into Soft-Simplex interior spreading, Jaccard QAP annealing, multi-modal embeddings, NNLS barycentric projection, and PAM k-Medoids.
- Core Strategies
- 7 min read
- Updated 2026-11-19
Key Takeaways
- SimplexClusteringStrategy decouples data representation cleanly: tag strategies set requiresTags: true, while embedding and similarity strategies set requiresTags: false.
- Quadratic Assignment Problem (QAP) simulated annealing places related clusters on adjacent mesh vertices so shared items land on planar edges and triangles.
- Soft-Simplex strategies distribute multi-cluster items smoothly across triangle interiors while leaving single-cluster items free in a 360-degree halo.
Stage 2 (SimplexClusteringStrategy) solves three coupled mathematical problems:
- Partitioning: Grouping domain items into
Kcoherent topic clusters or medoids/centroids. - Planar Mesh Embedding (QAP): Assigning those
Kclusters to theKvertices of the 60° simplex mesh so pairwise cluster affinity aligns with 1-hop mesh adjacency (preserving identities across updates via the Hungarian algorithm). - Barycentric Simplex Anchoring: Mapping every item onto its covering vertex (
1-simplex), shared edge (2-simplex), or triangle face (3-simplex) with normalized weights∑ w_i = 1.
Jaccard Annealing / Planar NNLS
Snaps items onto discrete vertices, shared edges, or centroids
Soft-Simplex Clustering / Projection
Continuous interior spread + free 360° single-cluster halo
Strategy Decision Matrix
createSoftSimplexTagClusteringStrategy(config?)
Recommended for rich tagged corpora. Combines load-balanced QAP with continuous interior spreading (triangleSpread: 0.45) while keeping single-cluster items unconstrained in a 360° vertex halo.
Open strategy reference →
createJaccardAnnealingClusteringStrategy(config?)
Regularized Jaccard tag partitioning + QAP Simulated Annealing + planar hitting-set completion for crisp snapping onto vertices, shared 2-cluster edges, and 3-cluster centroids.
Open strategy reference →
createIncrementalAnchorClusteringStrategy(config?)
Freezes existing vertex topics and UIDs on update(), routing newly arriving tags and items to their closest existing anchors without global reshuffling.
Open strategy reference →
createSoftSimplexEmbeddingClusteringStrategy(config)
Recommended for embeddings. Combines weighted multi-modal Spherical/L2 k-Means++ with load-balanced QAP and temperature-scaled interior 2-simplex projection.
Open strategy reference →
createEmbeddingClusteringStrategy(config)
Spherical/Euclidean k-Means++ + QAP + closed-form Non-Negative Least Squares (NNLS) projection onto planar mesh triangles.
Open strategy reference →
createSimilarityClusteringStrategy(config)
PAM k-Medoids + QAP mesh embedding + simplex projection for arbitrary pairwise similarity functions without explicit feature vectors.
Open strategy reference →
Parameter Effect: triangleSpread (0.00 vs. 0.45 vs. 0.90)
Raising triangleSpread smoothly distributes multi-cluster items across the covering 2-simplex triangle interior while keeping single-cluster items unconstrained in an outer 360° vertex halo:
triangleSpread: 0.00
Crisp snapping onto vertices, edge midpoints & centroid
triangleSpread: 0.45 (Default)
Balanced interior area + free 360° single-tag halo
triangleSpread: 0.90
Broad diffusion toward central triangle barycenter
Tag Rules: Planar Hitting-Set & Explaining-Away
In tagged collections, two subtle edge cases arise when projecting hypergraph tag overlaps onto a 2D planar triangulation:
sharedTagRule: 'planar-hitting-set'(Default): If a bridge tag co-occurs across clusters that cannot all touch on a planar graph, a weighted hitting-set pass promotes minimal bridge coverage onto shared mesh edges so cross-cutting items remain geometrically faithfully tethered.anchorRule: 'explaining-away'(Default): Ranks incident clusters by specificity and prunes redundant secondary matches once an item’s tags are explained, preventing generic tags from dragging every node toward the canvas center.
Closed-Form Planar NNLS Projection for Embeddings
For untagged vector embeddings x ∈ ℝ^d, createEmbeddingClusteringStrategy evaluates every candidate vertex, mesh edge, and mesh triangle τ = (c₁, c₂, c₃) and solves the exact constrained least-squares projection onto the 2-simplex Δ²:
minimize || x − (w₁·μ₁ + w₂·μ₂ + w₃·μ₃) ||₂²
subject to w₁, w₂, w₃ ≥ 0 and w₁ + w₂ + w₃ = 1
Selecting the planar simplex τ* with minimal reconstruction residual guarantees that every embedded item lands inside a true planar mesh triangle rather than across non-adjacent clusters.
Base-Rate-Aware Discriminative Cluster Labeling (features & peerClusters)
When clustering untagged embeddings or pairwise similarity kernels, naively naming each cluster after its most frequent category often produces duplicate badges whenever a single class dominates the corpus (for example, 77% of classic feature films carrying "Drama" as a primary genre, or two penguin clusters sharing the same species).
SimplexViz solves this directly inside Stage 2 and exposes the underlying primitives for custom deriveClusterMeta callbacks:
- Built-In
featuresOption on Embedding & Similarity Strategies: Passingfeatures: SubspaceZoomFeature<TItem>[]tocreateSoftSimplexEmbeddingClusteringStrategy,createEmbeddingClusteringStrategy, orcreateSimilarityClusteringStrategyinvokesassignDiscriminativeClusterLabelsacross allKsibling clusters—scoring numeric features by standardized z-score separation (|z_k|), boolean/categorical facets by specificity lift above corpus base rates, and shared taxonomic groups by intra-group secondary contrast (such as Adélie · Male vs. Adélie · Female). - Sibling Context in
deriveClusterMeta: EveryClusterDerivationContext<TItem, TTagMeta>receivesallItemsandpeerClusters: readonly PeerClusterContext<TItem, TTagMeta>[], enabling custom domain meta builders to callresolveDiscriminativeClusterLabel(ctx, { features })ordisambiguatePeerClusterTitle(ctx, getBaseTitle, getQualifier)with guaranteed pairwise uniqueness across the mesh.
Path-Independent Chronological Pinning (createFinalSeededClusteringStrategy)
When stepping chronologically (0 → N) through a growing corpus or applying interactive filters, running a clustering strategy from scratch on early sparse frames can cause clusters to jump vertices or rename themselves from frame to frame. Wrap any Stage 2 strategy—tag, embedding, similarity, or custom—with createFinalSeededClusteringStrategy:
import {
createFinalSeededClusteringStrategy,
createSoftSimplexEmbeddingClusteringStrategy,
} from '@simplex-viz/core';
const pinnedClustering = createFinalSeededClusteringStrategy(
createSoftSimplexEmbeddingClusteringStrategy({ getEmbedding: (d) => d.vec }),
{ seedItems: fullCorpus },
);
- Computes and pins the canonical full-corpus clusters, vertex assignments, UIDs, and OKLab colors once on initialization (or re-seeds cleanly whenever the viewport/mesh changes cluster count
K). - Projects every chronological or filtered subset onto those pinned anchors with zero cluster hopping and path-independent parity at the final frame.
- Enabled automatically whenever
timelineis active withautoFinalSeed: true(the default). To disable automatic pinning and let clusters re-form dynamically at every timeline step, passtimeline={{ ..., autoFinalSeed: false }}.