Docs Navigation (Stage 02)›

Planar NNLS Embedding Projection

Spherical/L2 k-Means++ with closed-form non-negative least-squares projection onto planar triangles.

Key Takeaways

  • Use when you want exact geometric least-squares reconstruction weights onto planar mesh simplices.
  • Supports sparse vertex/edge/triangle anchoring ('simplex-projection', 'explaining-away', or 'top-1') and optional contrastive feature naming.

Visual Mechanism

Orthogonal Projection onto Planar 2-Simplex Δ²μ₁μ₂μ₃x ∈ ℝ^dx̂ = ∑ wᵢμᵢClosed-Form Planar NNLS:min ‖x − (w₁μ₁ + w₂μ₂ + w₃μ₃)‖₂²s.t. wᵢ ≥ 0, w₁ + w₂ + w₃ = 1
Evaluates candidate planar triangles τ = (μ₁, μ₂, μ₃) and solves exact Non-Negative Least Squares (wᵢ ≥ 0, ∑ wᵢ = 1) to anchor each vector with minimal reconstruction residual.

Factory Signature

Re-exported from @simplex-viz/core, @simplex-viz/svg, and @simplex-viz/reactStage 02 Overview →
createEmbeddingClusteringStrategy<TItem, TTagMeta>(options: EmbeddingClusteringOptions<TItem>): SimplexClusteringStrategy<TItem, TTagMeta>

Options & Defaults

getEmbeddingDefault: required

(item: TItem) => readonly number[] | readonly EmbeddingSource<TItem>[]

Single or weighted multi-modal vector extractor.

featuresDefault: undefined

readonly SubspaceZoomFeature<TItem>[] | undefined

Optional domain features scored against corpus base rates to assign pairwise-distinct defaultLabels across all K clusters.

clusterCountDefault: auto (round(√N))

number | undefined

Preferred number of k-Means++ centroids K.

metricDefault: 'cosine'

'cosine' | 'euclidean'

Vector distance metric.

anchorRuleDefault: 'simplex-projection'

'simplex-projection' | 'explaining-away' | 'top-1'

Selects closed-form NNLS projection onto vertices, edges, and triangles.

maxIterationsDefault: 24

number

Maximum Spherical/Lloyd k-Means refinement passes.

Closed-Form Planar NNLS Projection

For each item vector x, Planar NNLS Embedding Projection evaluates every candidate planar simplex τ (vertices, 1-hop mesh edges, and 60° mesh triangles) and solves the exact constrained quadratic program minimizing || x − ∑ w_i · μ_i ||₂² subject to w_i ≥ 0 and ∑ w_i = 1. Selecting the planar simplex with lowest reconstruction residual guarantees faithful geometric interpolation without cross-mesh tangling, while optional features automatically synthesize contrastive, collision-free labels across all K vertices.

Usage Example

import {
  SimplexTopicGraph,
  createEmbeddingClusteringStrategy,
} from '@simplex-viz/react';

const nnlsProjection = createEmbeddingClusteringStrategy<DocVector>({
  getEmbedding: (doc) => doc.embedding,
  clusterCount: 8,
  metric: 'cosine',
  anchorRule: 'simplex-projection',
});

<SimplexTopicGraph items={docs} clusteringStrategy={nnlsProjection} />;