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) <noreply@anthropic.com>
This commit is contained in:
parent
ef6bc71009
commit
804220d7f6
2 changed files with 6 additions and 31 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -1314,6 +1314,6 @@
|
|||
</article>
|
||||
</div>
|
||||
|
||||
<script src="/static/dashboard.js?v=33d3c0e6"></script>
|
||||
<script src="/static/dashboard.js?v=2a8b8c03"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue