From 804220d7f6a9baa0b342d43a998ee0d04ce3b348 Mon Sep 17 00:00:00 2001 From: Max Gorog Date: Fri, 8 May 2026 16:39:45 -0500 Subject: [PATCH] knn scatter: revert to real-data only (no demo handlers) The KNN producer works; KNN does not need a demo-mode fallback. Remove demo_start / demo_stop / cachedReal / demoActive scaffolding that I'd added speculatively. Embedding events render directly. Co-Authored-By: Claude Opus 4.7 (1M context) --- training/dashboard/static/dashboard.js | 35 ++++---------------------- training/dashboard/static/index.html | 2 +- 2 files changed, 6 insertions(+), 31 deletions(-) diff --git a/training/dashboard/static/dashboard.js b/training/dashboard/static/dashboard.js index fb29ff6..314533c 100644 --- a/training/dashboard/static/dashboard.js +++ b/training/dashboard/static/dashboard.js @@ -2102,29 +2102,8 @@ def train_nn(*, model, X_train, y_train, X_val, y_val, rebuildLegend(); } - // Exclusive: demo on → only synthetic clusters; demo off → only - // real embedding events. cachedReal accumulates real points - // even while demo is on, so demo_stop restores them. - let demoActive = false; - const cachedReal = []; - const REAL_CACHE_CAP = 5000; - function repaintFromReal() { - points.length = 0; - resetStats(); - for (const pt of cachedReal) { - points.push(pt); - addStat(pt); - } - rebuildLegend(); - } - on('demo_start', () => { - demoActive = true; - loadSynthetic(); - }); - on('demo_stop', () => { - demoActive = false; - repaintFromReal(); - }); + // KNN scatter is real-data only: it has a working producer and + // doesn't participate in demo mode at all. on('embedding', m => { if (typeof m.x !== 'number' || typeof m.y !== 'number') return; const pt = { @@ -2134,13 +2113,9 @@ def train_nn(*, model, X_train, y_train, X_val, y_val, predicted: m.predicted, cluster: typeof m.cluster === 'number' ? m.cluster : undefined, }; - cachedReal.push(pt); - if (cachedReal.length > REAL_CACHE_CAP) cachedReal.shift(); - if (!demoActive) { - points.push(pt); - addStat(pt); - rebuildLegend(); - } + points.push(pt); + addStat(pt); + rebuildLegend(); }); rebuildLegend(); diff --git a/training/dashboard/static/index.html b/training/dashboard/static/index.html index b85b8c1..17408cd 100644 --- a/training/dashboard/static/index.html +++ b/training/dashboard/static/index.html @@ -1314,6 +1314,6 @@ - +