thinkwee commited on
Commit Β·
1c53c11
1
Parent(s): 41d056a
fix display
Browse files- charts.js +87 -91
- index.html +2 -2
charts.js
CHANGED
|
@@ -377,9 +377,9 @@ document.querySelectorAll('.dim-btn:not(.probing-dim)').forEach(btn => {
|
|
| 377 |
});
|
| 378 |
|
| 379 |
// ============================================================================
|
| 380 |
-
// RANKING COMPARISON - 3 Charts with
|
| 381 |
// ============================================================================
|
| 382 |
-
let currentRankingMode = '
|
| 383 |
|
| 384 |
function renderRankingCharts(mode) {
|
| 385 |
const scenarios = [
|
|
@@ -389,120 +389,116 @@ function renderRankingCharts(mode) {
|
|
| 389 |
];
|
| 390 |
|
| 391 |
scenarios.forEach(({ key, id }) => {
|
| 392 |
-
const
|
| 393 |
-
if (!
|
| 394 |
|
| 395 |
-
|
| 396 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 397 |
|
| 398 |
-
//
|
| 399 |
-
const
|
| 400 |
-
|
| 401 |
-
case 'novelty': return m.bt_rank;
|
| 402 |
-
case 'accuracy': return m.acc_rank;
|
| 403 |
-
default: return m.bt_rank; // For comparison, use bt_rank as base
|
| 404 |
-
}
|
| 405 |
-
};
|
| 406 |
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
y: [i, i],
|
| 413 |
-
mode: 'lines',
|
| 414 |
-
line: {
|
| 415 |
-
color: 'rgba(148, 163, 184, 0.3)',
|
| 416 |
-
width: 1.5,
|
| 417 |
-
dash: 'dot'
|
| 418 |
-
},
|
| 419 |
-
showlegend: false,
|
| 420 |
-
hoverinfo: 'skip'
|
| 421 |
-
});
|
| 422 |
-
});
|
| 423 |
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
mode: 'markers',
|
| 429 |
-
name: 'Novelty Rank',
|
| 430 |
-
marker: {
|
| 431 |
-
size: 10,
|
| 432 |
-
symbol: 'circle',
|
| 433 |
-
color: '#8B5CF6',
|
| 434 |
-
line: { color: '#fff', width: 1 }
|
| 435 |
-
},
|
| 436 |
-
text: models.map(m => `${m.model}<br>Novelty: #${m.bt_rank}<br>Win Rate: ${m.win_rate}%`),
|
| 437 |
-
hovertemplate: '%{text}<extra></extra>'
|
| 438 |
-
});
|
| 439 |
|
| 440 |
-
// Accuracy rank points
|
| 441 |
traces.push({
|
| 442 |
-
x:
|
| 443 |
-
y:
|
| 444 |
-
mode: '
|
| 445 |
-
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
|
| 449 |
-
color: '#22C55E',
|
| 450 |
-
line: { color: '#fff', width: 1 }
|
| 451 |
},
|
| 452 |
-
|
| 453 |
-
|
| 454 |
});
|
| 455 |
-
}
|
| 456 |
-
// Single mode - just points
|
| 457 |
-
const xVals = models.map(m => mode === 'novelty' ? m.bt_rank : m.acc_rank);
|
| 458 |
-
const color = mode === 'novelty' ? '#8B5CF6' : '#22C55E';
|
| 459 |
-
const label = mode === 'novelty' ? 'Novelty' : 'Accuracy';
|
| 460 |
|
| 461 |
-
|
| 462 |
-
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
|
| 467 |
-
|
| 468 |
-
|
| 469 |
-
|
| 470 |
-
|
| 471 |
-
}
|
| 472 |
-
|
| 473 |
-
|
| 474 |
-
|
| 475 |
-
}
|
| 476 |
-
|
| 477 |
-
}
|
| 478 |
-
}
|
| 479 |
-
|
| 480 |
-
}
|
| 481 |
-
}
|
| 482 |
|
| 483 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 484 |
|
| 485 |
const layout = {
|
| 486 |
...darkLayout,
|
| 487 |
xaxis: {
|
| 488 |
...darkLayout.xaxis,
|
| 489 |
title: { text: 'Rank', font: { size: 11, color: '#e2e8f0' } },
|
| 490 |
-
range: [
|
| 491 |
-
dtick:
|
|
|
|
| 492 |
},
|
| 493 |
yaxis: {
|
| 494 |
...darkLayout.yaxis,
|
| 495 |
tickmode: 'array',
|
| 496 |
tickvals: models.map((_, i) => i),
|
| 497 |
-
ticktext: models.map(m => m.model.length >
|
| 498 |
-
automargin: true
|
|
|
|
| 499 |
},
|
| 500 |
showlegend: true,
|
| 501 |
legend: {
|
| 502 |
...darkLayout.legend,
|
| 503 |
-
y: -0.
|
|
|
|
|
|
|
|
|
|
| 504 |
},
|
| 505 |
-
margin: {
|
| 506 |
};
|
| 507 |
|
| 508 |
Plotly.react(`ranking-${id}`, traces, layout, plotlyConfig);
|
|
@@ -510,7 +506,7 @@ function renderRankingCharts(mode) {
|
|
| 510 |
}
|
| 511 |
|
| 512 |
function initRankingCharts() {
|
| 513 |
-
renderRankingCharts('
|
| 514 |
}
|
| 515 |
|
| 516 |
// Ranking mode toggle event listener
|
|
|
|
| 377 |
});
|
| 378 |
|
| 379 |
// ============================================================================
|
| 380 |
+
// RANKING COMPARISON - 3 Charts with mode switching (novelty vs accuracy)
|
| 381 |
// ============================================================================
|
| 382 |
+
let currentRankingMode = 'novelty';
|
| 383 |
|
| 384 |
function renderRankingCharts(mode) {
|
| 385 |
const scenarios = [
|
|
|
|
| 389 |
];
|
| 390 |
|
| 391 |
scenarios.forEach(({ key, id }) => {
|
| 392 |
+
const rawData = DDR_DATA.ranking[key];
|
| 393 |
+
if (!rawData) return;
|
| 394 |
|
| 395 |
+
// Sort models by the primary ranking
|
| 396 |
+
let sortedModels;
|
| 397 |
+
if (mode === 'novelty') {
|
| 398 |
+
sortedModels = [...rawData].sort((a, b) => a.bt_rank - b.bt_rank);
|
| 399 |
+
} else {
|
| 400 |
+
sortedModels = [...rawData].sort((a, b) => a.acc_rank - b.acc_rank);
|
| 401 |
+
}
|
| 402 |
|
| 403 |
+
// Take top 12 for display
|
| 404 |
+
const models = sortedModels.slice(0, 12);
|
| 405 |
+
const traces = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 406 |
|
| 407 |
+
// Define colors
|
| 408 |
+
const primaryColor = mode === 'novelty' ? '#8B5CF6' : '#22C55E';
|
| 409 |
+
const secondaryColor = mode === 'novelty' ? '#22C55E' : '#8B5CF6';
|
| 410 |
+
const primaryLabel = mode === 'novelty' ? 'Novelty Rank' : 'Accuracy Rank';
|
| 411 |
+
const secondaryLabel = mode === 'novelty' ? 'Accuracy Rank' : 'Novelty Rank';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 412 |
|
| 413 |
+
// Connection lines (dashed) from primary to secondary
|
| 414 |
+
models.forEach((m, i) => {
|
| 415 |
+
const primaryX = mode === 'novelty' ? m.bt_rank : m.acc_rank;
|
| 416 |
+
const secondaryX = mode === 'novelty' ? m.acc_rank : m.bt_rank;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 417 |
|
|
|
|
| 418 |
traces.push({
|
| 419 |
+
x: [primaryX, secondaryX],
|
| 420 |
+
y: [i, i],
|
| 421 |
+
mode: 'lines',
|
| 422 |
+
line: {
|
| 423 |
+
color: 'rgba(148, 163, 184, 0.4)',
|
| 424 |
+
width: 1.5,
|
| 425 |
+
dash: 'dot'
|
|
|
|
|
|
|
| 426 |
},
|
| 427 |
+
showlegend: false,
|
| 428 |
+
hoverinfo: 'skip'
|
| 429 |
});
|
| 430 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
| 431 |
|
| 432 |
+
// Primary rank points (filled circles)
|
| 433 |
+
traces.push({
|
| 434 |
+
x: models.map(m => mode === 'novelty' ? m.bt_rank : m.acc_rank),
|
| 435 |
+
y: models.map((_, i) => i),
|
| 436 |
+
mode: 'markers',
|
| 437 |
+
name: primaryLabel,
|
| 438 |
+
marker: {
|
| 439 |
+
size: 11,
|
| 440 |
+
symbol: 'circle',
|
| 441 |
+
color: primaryColor,
|
| 442 |
+
line: { color: '#fff', width: 1.5 }
|
| 443 |
+
},
|
| 444 |
+
text: models.map(m => {
|
| 445 |
+
if (mode === 'novelty') {
|
| 446 |
+
return `<b>${m.model}</b><br>Novelty: #${m.bt_rank}<br>Win Rate: ${m.win_rate}%`;
|
| 447 |
+
} else {
|
| 448 |
+
return `<b>${m.model}</b><br>Accuracy: #${m.acc_rank}<br>${m.accuracy}%`;
|
| 449 |
+
}
|
| 450 |
+
}),
|
| 451 |
+
hovertemplate: '%{text}<extra></extra>'
|
| 452 |
+
});
|
| 453 |
|
| 454 |
+
// Secondary rank points (diamond outline)
|
| 455 |
+
traces.push({
|
| 456 |
+
x: models.map(m => mode === 'novelty' ? m.acc_rank : m.bt_rank),
|
| 457 |
+
y: models.map((_, i) => i),
|
| 458 |
+
mode: 'markers',
|
| 459 |
+
name: secondaryLabel,
|
| 460 |
+
marker: {
|
| 461 |
+
size: 9,
|
| 462 |
+
symbol: 'diamond-open',
|
| 463 |
+
color: secondaryColor,
|
| 464 |
+
line: { width: 2 }
|
| 465 |
+
},
|
| 466 |
+
text: models.map(m => {
|
| 467 |
+
if (mode === 'novelty') {
|
| 468 |
+
return `<b>${m.model}</b><br>Accuracy: #${m.acc_rank}<br>${m.accuracy}%`;
|
| 469 |
+
} else {
|
| 470 |
+
return `<b>${m.model}</b><br>Novelty: #${m.bt_rank}<br>Win Rate: ${m.win_rate}%`;
|
| 471 |
+
}
|
| 472 |
+
}),
|
| 473 |
+
hovertemplate: '%{text}<extra></extra>'
|
| 474 |
+
});
|
| 475 |
|
| 476 |
const layout = {
|
| 477 |
...darkLayout,
|
| 478 |
xaxis: {
|
| 479 |
...darkLayout.xaxis,
|
| 480 |
title: { text: 'Rank', font: { size: 11, color: '#e2e8f0' } },
|
| 481 |
+
range: [23, 0], // Fixed range for all charts
|
| 482 |
+
dtick: 5,
|
| 483 |
+
tick0: 0
|
| 484 |
},
|
| 485 |
yaxis: {
|
| 486 |
...darkLayout.yaxis,
|
| 487 |
tickmode: 'array',
|
| 488 |
tickvals: models.map((_, i) => i),
|
| 489 |
+
ticktext: models.map(m => m.model.length > 16 ? m.model.substring(0, 14) + '...' : m.model),
|
| 490 |
+
automargin: true,
|
| 491 |
+
range: [-0.5, models.length - 0.5]
|
| 492 |
},
|
| 493 |
showlegend: true,
|
| 494 |
legend: {
|
| 495 |
...darkLayout.legend,
|
| 496 |
+
y: -0.18,
|
| 497 |
+
orientation: 'h',
|
| 498 |
+
x: 0.5,
|
| 499 |
+
xanchor: 'center'
|
| 500 |
},
|
| 501 |
+
margin: { t: 20, r: 15, b: 65, l: 120 }
|
| 502 |
};
|
| 503 |
|
| 504 |
Plotly.react(`ranking-${id}`, traces, layout, plotlyConfig);
|
|
|
|
| 506 |
}
|
| 507 |
|
| 508 |
function initRankingCharts() {
|
| 509 |
+
renderRankingCharts('novelty');
|
| 510 |
}
|
| 511 |
|
| 512 |
// Ranking mode toggle event listener
|
index.html
CHANGED
|
@@ -88,10 +88,10 @@
|
|
| 88 |
</p>
|
| 89 |
</div>
|
| 90 |
<div class="dimension-toggle">
|
| 91 |
-
<button class="dim-btn ranking-dim active" data-mode="
|
| 92 |
-
<button class="dim-btn ranking-dim" data-mode="novelty">π― Novelty Rank</button>
|
| 93 |
<button class="dim-btn ranking-dim" data-mode="accuracy">π Accuracy Rank</button>
|
| 94 |
</div>
|
|
|
|
| 95 |
<div class="charts-grid three-col">
|
| 96 |
<div class="chart-card">
|
| 97 |
<h3>MIMIC</h3>
|
|
|
|
| 88 |
</p>
|
| 89 |
</div>
|
| 90 |
<div class="dimension-toggle">
|
| 91 |
+
<button class="dim-btn ranking-dim active" data-mode="novelty">π― Novelty Rank</button>
|
|
|
|
| 92 |
<button class="dim-btn ranking-dim" data-mode="accuracy">π Accuracy Rank</button>
|
| 93 |
</div>
|
| 94 |
+
|
| 95 |
<div class="charts-grid three-col">
|
| 96 |
<div class="chart-card">
|
| 97 |
<h3>MIMIC</h3>
|