Spaces:
Sleeping
Sleeping
Update index.html
Browse files- index.html +36 -53
index.html
CHANGED
|
@@ -192,23 +192,15 @@
|
|
| 192 |
// ββ CONFIG STATE ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 193 |
const cfg = { mode: 'training', architecture: 'additive', k_mode: 'single' };
|
| 194 |
let nHidden = 1;
|
|
|
|
| 195 |
|
| 196 |
function updateKParamCount() {
|
| 197 |
const n = nHidden;
|
| 198 |
const p = cfg.k_mode === 'single' ? (2 + n) : (3 * n);
|
| 199 |
document.getElementById('k-param-count').innerText = `K params: ${p}`;
|
| 200 |
}
|
| 201 |
-
|
| 202 |
-
/*
|
| 203 |
-
function changeHidden(delta) {
|
| 204 |
-
nHidden = Math.max(1, Math.min(8, nHidden + delta));
|
| 205 |
-
document.getElementById('hidden-count').innerText = nHidden;
|
| 206 |
-
document.getElementById('b-h-n').innerText = nHidden;
|
| 207 |
-
updateKParamCount();
|
| 208 |
-
}
|
| 209 |
-
*/
|
| 210 |
|
| 211 |
-
|
| 212 |
const res = await fetch('/set_hidden', {
|
| 213 |
method: 'POST',
|
| 214 |
headers: {'Content-Type': 'application/json'},
|
|
@@ -221,22 +213,14 @@ function changeHidden(delta) {
|
|
| 221 |
document.getElementById('hidden-count').innerText = nHidden;
|
| 222 |
document.getElementById('b-h-n').innerText = nHidden;
|
| 223 |
|
| 224 |
-
|
|
|
|
|
|
|
| 225 |
}
|
| 226 |
|
| 227 |
-
|
| 228 |
// Quick +/- right from the header badge (calls server immediately)
|
| 229 |
async function quickH(delta) {
|
| 230 |
-
|
| 231 |
-
method: 'POST', headers: {'Content-Type':'application/json'},
|
| 232 |
-
body: JSON.stringify({ delta })
|
| 233 |
-
});
|
| 234 |
-
const d = await res.json();
|
| 235 |
-
nHidden = d.n_hidden;
|
| 236 |
-
document.getElementById('hidden-count').innerText = nHidden;
|
| 237 |
-
document.getElementById('b-h-n').innerText = nHidden;
|
| 238 |
-
updateKParamCount();
|
| 239 |
-
meshPlotted = errPlotted = false;
|
| 240 |
}
|
| 241 |
|
| 242 |
function pick(key, val, btn, cls) {
|
|
@@ -264,7 +248,8 @@ async function applyConfig() {
|
|
| 264 |
document.getElementById('b-k').innerText = cfg.k_mode === 'single' ? 'SNGL-K' : 'TRPL-K';
|
| 265 |
document.getElementById('b-h-n').innerText = nHidden;
|
| 266 |
document.getElementById('b-data').innerText = ds.slice(0,6).toUpperCase();
|
| 267 |
-
meshPlotted =
|
|
|
|
| 268 |
toggleDrawer();
|
| 269 |
}
|
| 270 |
|
|
@@ -351,44 +336,42 @@ function tab(name) {
|
|
| 351 |
|
| 352 |
// ββ VISUALIZATION βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 353 |
|
| 354 |
-
|
| 355 |
-
//
|
| 356 |
function getNodePositions(n) {
|
| 357 |
-
const pos = { A: [-4.5, 1.8], B: [-4.5, -1.8], C: [4.5, 0] };
|
| 358 |
-
if (n === 1) {
|
| 359 |
-
pos['H1'] = [0, 0];
|
| 360 |
-
} else {
|
| 361 |
-
const spread = Math.min(3.2, 0.85 * n);
|
| 362 |
-
for (let i = 1; i <= n; i++) {
|
| 363 |
-
const t = (i - 1) / (n - 1);
|
| 364 |
-
pos[`H${i}`] = [0, spread * (1 - 2 * t)];
|
| 365 |
-
}
|
| 366 |
-
}
|
| 367 |
-
return pos;
|
| 368 |
-
}
|
| 369 |
-
*/
|
| 370 |
-
|
| 371 |
-
function getNodePositions(n) {
|
| 372 |
const pos = {
|
| 373 |
-
A: [-4.5,
|
| 374 |
-
B: [-4.5, -2],
|
| 375 |
-
C: [4.5,
|
| 376 |
};
|
| 377 |
|
| 378 |
-
|
|
|
|
|
|
|
|
|
|
| 379 |
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
const y = spread * (1 - 2 * t);
|
| 383 |
|
| 384 |
-
|
| 385 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 386 |
|
| 387 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 388 |
}
|
| 389 |
|
| 390 |
return pos;
|
| 391 |
-
|
| 392 |
|
| 393 |
function getEdgeList(n) {
|
| 394 |
const edges = [];
|
|
@@ -457,8 +440,6 @@ const ERR_LAYOUT = {
|
|
| 457 |
showlegend:false
|
| 458 |
};
|
| 459 |
|
| 460 |
-
let meshPlotted = false, errPlotted = false;
|
| 461 |
-
|
| 462 |
// ββ POLL ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 463 |
setInterval(async () => {
|
| 464 |
try {
|
|
@@ -471,6 +452,8 @@ setInterval(async () => {
|
|
| 471 |
document.getElementById('hidden-count').innerText = nHidden;
|
| 472 |
document.getElementById('b-h-n').innerText = nHidden;
|
| 473 |
updateKParamCount();
|
|
|
|
|
|
|
| 474 |
}
|
| 475 |
|
| 476 |
document.getElementById('run-dot').className =
|
|
|
|
| 192 |
// ββ CONFIG STATE ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 193 |
const cfg = { mode: 'training', architecture: 'additive', k_mode: 'single' };
|
| 194 |
let nHidden = 1;
|
| 195 |
+
let meshPlotted = false, errPlotted = false;
|
| 196 |
|
| 197 |
function updateKParamCount() {
|
| 198 |
const n = nHidden;
|
| 199 |
const p = cfg.k_mode === 'single' ? (2 + n) : (3 * n);
|
| 200 |
document.getElementById('k-param-count').innerText = `K params: ${p}`;
|
| 201 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
|
| 203 |
+
async function changeHidden(delta) {
|
| 204 |
const res = await fetch('/set_hidden', {
|
| 205 |
method: 'POST',
|
| 206 |
headers: {'Content-Type': 'application/json'},
|
|
|
|
| 213 |
document.getElementById('hidden-count').innerText = nHidden;
|
| 214 |
document.getElementById('b-h-n').innerText = nHidden;
|
| 215 |
|
| 216 |
+
updateKParamCount();
|
| 217 |
+
meshPlotted = false;
|
| 218 |
+
errPlotted = false;
|
| 219 |
}
|
| 220 |
|
|
|
|
| 221 |
// Quick +/- right from the header badge (calls server immediately)
|
| 222 |
async function quickH(delta) {
|
| 223 |
+
await changeHidden(delta);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
}
|
| 225 |
|
| 226 |
function pick(key, val, btn, cls) {
|
|
|
|
| 248 |
document.getElementById('b-k').innerText = cfg.k_mode === 'single' ? 'SNGL-K' : 'TRPL-K';
|
| 249 |
document.getElementById('b-h-n').innerText = nHidden;
|
| 250 |
document.getElementById('b-data').innerText = ds.slice(0,6).toUpperCase();
|
| 251 |
+
meshPlotted = false;
|
| 252 |
+
errPlotted = false;
|
| 253 |
toggleDrawer();
|
| 254 |
}
|
| 255 |
|
|
|
|
| 336 |
|
| 337 |
// ββ VISUALIZATION βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 338 |
|
| 339 |
+
// Proper hourglass layout: hidden nodes split into an upper funnel and a lower funnel.
|
| 340 |
+
// This prevents the "fan/web" look while preserving every existing edge.
|
| 341 |
function getNodePositions(n) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 342 |
const pos = {
|
| 343 |
+
A: [-4.5, 2.0],
|
| 344 |
+
B: [-4.5, -2.0],
|
| 345 |
+
C: [ 4.5, 0.0]
|
| 346 |
};
|
| 347 |
|
| 348 |
+
if (n === 1) {
|
| 349 |
+
pos.H1 = [0.0, 0.0];
|
| 350 |
+
return pos;
|
| 351 |
+
}
|
| 352 |
|
| 353 |
+
const topCount = Math.ceil(n / 2);
|
| 354 |
+
const bottomCount = n - topCount;
|
|
|
|
| 355 |
|
| 356 |
+
// Upper funnel: A/B side toward center, then down toward the middle
|
| 357 |
+
for (let i = 1; i <= topCount; i++) {
|
| 358 |
+
const t = topCount === 1 ? 0 : (i - 1) / (topCount - 1);
|
| 359 |
+
const x = -1.6 + (t * 1.6);
|
| 360 |
+
const y = 1.8 - (t * 1.5);
|
| 361 |
+
pos[`H${i}`] = [x, y];
|
| 362 |
+
}
|
| 363 |
|
| 364 |
+
// Lower funnel: A/B side toward center, then up toward the middle
|
| 365 |
+
for (let j = 1; j <= bottomCount; j++) {
|
| 366 |
+
const i = topCount + j;
|
| 367 |
+
const t = bottomCount === 1 ? 0 : (j - 1) / (bottomCount - 1);
|
| 368 |
+
const x = -1.6 + (t * 1.6);
|
| 369 |
+
const y = -1.8 + (t * 1.5);
|
| 370 |
+
pos[`H${i}`] = [x, y];
|
| 371 |
}
|
| 372 |
|
| 373 |
return pos;
|
| 374 |
+
}
|
| 375 |
|
| 376 |
function getEdgeList(n) {
|
| 377 |
const edges = [];
|
|
|
|
| 440 |
showlegend:false
|
| 441 |
};
|
| 442 |
|
|
|
|
|
|
|
| 443 |
// ββ POLL ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 444 |
setInterval(async () => {
|
| 445 |
try {
|
|
|
|
| 452 |
document.getElementById('hidden-count').innerText = nHidden;
|
| 453 |
document.getElementById('b-h-n').innerText = nHidden;
|
| 454 |
updateKParamCount();
|
| 455 |
+
meshPlotted = false;
|
| 456 |
+
errPlotted = false;
|
| 457 |
}
|
| 458 |
|
| 459 |
document.getElementById('run-dot').className =
|