Skip to content

Commit 8a42aca

Browse files
committed
Update interactive divergence fitting page
1 parent 463a490 commit 8a42aca

1 file changed

Lines changed: 10 additions & 17 deletions

File tree

interactive-divergence-fitting.html

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -277,22 +277,26 @@ <h1>Interactive Divergence Fitting</h1>
277277
</label></span>
278278
<span style="flex:1;"></span>
279279
<select id="select-divergence" style="padding:2px 6px; border:1px solid #ccc; border-radius:3px;">
280-
<option value="kl">KL divergence</option>
281-
<option value="chisq">χ² divergence</option>
280+
<option value="kl">KL</option>
281+
<option value="chisq">χ²</option>
282282
</select>
283283
</div>
284-
<div class="control-row">
285-
<button id="btn-playpause" title="Play/pause optimization (space)" class="active"><span class="key"></span></button>
286-
<button id="btn-step" title="Advance one gradient step (>)"><span class="key">&gt;</span></button>
284+
<div class="control-row" style="flex-wrap:wrap;">
285+
<span style="display:flex; gap:10px; align-items:center; flex-wrap:nowrap;">
286+
<button id="btn-playpause" title="Play/pause optimization (space)"><span class="key"></span></button>
287+
<button id="btn-step" title="Advance one gradient step (>)" disabled><span class="key">&gt;</span></button>
287288
<label title="Optimization speed (gradient steps per second)">Speed: <input type="range" id="slider-speed"
288289
min="0" max="1000" value="446" step="1" list="speed-ticks" style="width:100px;"></label>
289290
<datalist id="speed-ticks"><option value="446" label="1/frame"></datalist>
290291
<span class="fps-display" id="fps-display" style="color:#aaa; font-family:monospace;">... steps/s</span>
292+
</span>
293+
<span style="display:flex; gap:10px; align-items:center;">
291294
<label title="Learning rate (decays as lr₀ / (1 + 0.001t))">LR: <input type="range" id="slider-lr" min="1" max="30" value="8">
292295
<span id="val-lr">0.08</span></label>
293296
<label title="Mixture weight: 0 = all left, 1 = all right">$p$ mix: <input type="range"
294297
id="slider-mix" min="0" max="100" value="50" step="1">
295298
<span id="val-mix">0.50</span></label>
299+
</span>
296300
</div>
297301
<div class="control-row" style="flex-wrap:wrap;">
298302
<span style="display:flex; gap:10px; align-items:center; flex-wrap:nowrap; overflow:hidden;">$\textcolor{#7B2D8E}{q_\phi}$:
@@ -502,7 +506,7 @@ <h1>Interactive Divergence Fitting</h1>
502506
let optFwd = null; // { mu, sigma }
503507
let optRev = []; // [{ mu, sigma, kl }, ...]
504508

505-
let running = false;
509+
let running = true;
506510
let K = 64;
507511
let baseLR = 0.08;
508512

@@ -1919,8 +1923,6 @@ <h1>Interactive Divergence Fitting</h1>
19191923

19201924
// Divergence type selector
19211925
const selectDiv = document.getElementById('select-divergence');
1922-
const divOptsFull = ['KL divergence', 'χ² divergence'];
1923-
const divOptsShort = ['KL', 'χ²'];
19241926

19251927
function updateViaLabels() {
19261928
const fwdVia = document.getElementById('fwd-via');
@@ -2155,9 +2157,6 @@ <h1>Interactive Divergence Fitting</h1>
21552157

21562158
// Auto-shrink row labels and control rows to fit without wrapping
21572159
function fitRowLabels() {
2158-
// Reset divergence select to full labels
2159-
selectDiv.options[0].textContent = divOptsFull[0];
2160-
selectDiv.options[1].textContent = divOptsFull[1];
21612160
for (const el of document.querySelectorAll('.row-label, .control-row:not([style*="flex-wrap:wrap"])')) {
21622161
el.style.fontSize = '';
21632162
let size = parseFloat(getComputedStyle(el).fontSize);
@@ -2166,12 +2165,6 @@ <h1>Interactive Divergence Fitting</h1>
21662165
el.style.fontSize = size + 'px';
21672166
}
21682167
}
2169-
// If the top control row is still too tight, collapse divergence labels
2170-
const topRow = document.querySelector('.control-row');
2171-
if (topRow && topRow.scrollWidth > topRow.clientWidth) {
2172-
selectDiv.options[0].textContent = divOptsShort[0];
2173-
selectDiv.options[1].textContent = divOptsShort[1];
2174-
}
21752168
}
21762169
fitRowLabels();
21772170
window.addEventListener('resize', fitRowLabels);

0 commit comments

Comments
 (0)