File size: 5,698 Bytes
94e0fc9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>AutoFS Leaderboard</title>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<style>
body {
font-family: Arial, sans-serif;
margin: 40px;
}
table {
border-collapse: collapse;
width: 100%;
}
th, td {
border: 1px solid #ddd;
padding: 10px;
text-align: center;
}
th {
cursor: pointer;
background-color: #f5f5f5;
user-select: none;
}
th span {
margin-left: 6px;
font-size: 12px;
opacity: 0.7;
}
tr:nth-child(even) {
background-color: #fafafa;
}
.chart-row {
display: flex;
gap: 40px;
margin-top: 40px;
}
.chart-container {
width: 50%;
}
.chart-row-single {
display: flex;
justify-content: center;
margin-top: 40px;
}
.chart-container-single {
width: 60%;
}
</style>
</head>
<body>
<h1>Feature Selection Leaderboard</h1>
<table>
<thead>
<tr>
<th>Rank</th>
<th onclick="sortTable('algorithm')">Algorithm <span id="arrow-algorithm">↕</span></th>
<th onclick="sortTable('num_features')">#Features <span id="arrow-num_features">↕</span></th>
<th onclick="sortTable('mean_f1')">Mean F1 <span id="arrow-mean_f1">↕</span></th>
<th onclick="sortTable('mean_auc')">Mean AUC <span id="arrow-mean_auc">↕</span></th>
<th onclick="sortTable('time')">Time (s) <span id="arrow-time">↕</span></th>
</tr>
</thead>
<tbody id="tbody"></tbody>
</table>
<!-- F1 & AUC -->
<div class="chart-row">
<div class="chart-container">
<canvas id="f1Chart"></canvas>
</div>
<div class="chart-container">
<canvas id="aucChart"></canvas>
</div>
</div>
<!-- Time -->
<div class="chart-row-single">
<div class="chart-container-single">
<canvas id="timeChart"></canvas>
</div>
</div>
<script>
let leaderboardData = {{ leaderboard | tojson }};
let sortKey = null;
let sortAsc = true;
let f1Chart, aucChart, timeChart;
const metricOrder = {
algorithm: "asc", // 字符串
num_features: "asc", // 少特征更好(你也可以改)
mean_f1: "desc", // 越大越好
mean_auc: "desc", // 越大越好
time: "asc" // 越小越好 ✅
};
function renderTable() {
const tbody = document.getElementById("tbody");
tbody.innerHTML = "";
const n = leaderboardData.length;
const isBestFirst =
(metricOrder[sortKey] === "desc" && !sortAsc) ||
(metricOrder[sortKey] === "asc" && sortAsc);
leaderboardData.forEach((r, i) => {
const rank = isBestFirst ? i + 1 : n - i;
tbody.insertAdjacentHTML("beforeend", `
<tr>
<td>${rank}</td>
<td>${r.algorithm}</td>
<td>${r.num_features}</td>
<td>${r.mean_f1.toFixed(4)}</td>
<td>${r.mean_auc.toFixed(4)}</td>
<td>${r.time.toFixed(2)}</td>
</tr>
`);
});
}
function sortTable(key) {
if (sortKey === key) {
sortAsc = !sortAsc;
} else {
sortKey = key;
sortAsc = metricOrder[key] === "asc";
}
leaderboardData.sort((a, b) => {
if (typeof a[key] === "string") {
return sortAsc
? a[key].localeCompare(b[key])
: b[key].localeCompare(a[key]);
}
return sortAsc ? a[key] - b[key] : b[key] - a[key];
});
updateArrows();
renderTable();
updateCharts();
}
function updateArrows() {
document.querySelectorAll("th span").forEach(s => s.textContent = "↕");
document.getElementById("arrow-" + sortKey).textContent = sortAsc ? "↑" : "↓";
}
function updateCharts() {
const labels = leaderboardData.map(r => r.algorithm);
if (f1Chart) f1Chart.destroy();
if (aucChart) aucChart.destroy();
if (timeChart) timeChart.destroy();
const baseOptions = title => ({
responsive: true,
maintainAspectRatio: true,
aspectRatio: 2,
plugins: { title: { display: true, text: title } }
});
f1Chart = new Chart(document.getElementById("f1Chart"), {
type: "line",
data: {
labels,
datasets: [{ label: "Mean F1", data: leaderboardData.map(r => r.mean_f1) }]
},
options: baseOptions("Mean F1 Curve")
});
aucChart = new Chart(document.getElementById("aucChart"), {
type: "line",
data: {
labels,
datasets: [{ label: "Mean AUC", data: leaderboardData.map(r => r.mean_auc) }]
},
options: baseOptions("Mean AUC Curve")
});
timeChart = new Chart(document.getElementById("timeChart"), {
type: "line",
data: {
labels,
datasets: [{ label: "Time (s)", data: leaderboardData.map(r => r.time) }]
},
options: baseOptions("Runtime Curve")
});
}
renderTable();
updateCharts();
</script>
</body>
</html>
|