Download AutoFS/Webapp/templates/index11.html from Fancy-yousa/FeatureSelect-Methods-Leaderboard: direct link, hf CLI and curl.
- Browser
- Download file 4.48 kB
-
https://huggingface.co/spaces/Fancy-yousa/FeatureSelect-Methods-Leaderboard/resolve/main/AutoFS/Webapp/templates/index11.html
- Command line
-
hf download hf://spaces/Fancy-yousa/FeatureSelect-Methods-Leaderboard/AutoFS/Webapp/templates/index11.html
-
curl -L -o index11.html https://huggingface.co/spaces/Fancy-yousa/FeatureSelect-Methods-Leaderboard/resolve/main/AutoFS/Webapp/templates/index11.html
4.48 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Feature Selection Leaderboard</title> | |
| <style> | |
| body { font-family: Arial, sans-serif; margin: 20px; } | |
| table { border-collapse: collapse; width: 100%; margin-top: 20px; } | |
| th, td { border: 1px solid #ddd; padding: 8px; text-align: center; } | |
| th { cursor: pointer; background-color: #f2f2f2; position: relative; } | |
| th .arrow { font-size: 12px; margin-left: 4px; } | |
| select { padding: 5px; margin-bottom: 10px; } | |
| </style> | |
| </head> | |
| <body> | |
| <h1>Feature Selection Leaderboard</h1> | |
| <label for="dataset-select">Select Dataset:</label> | |
| <select id="dataset-select"> | |
| <!-- 这里的 options 会在后端渲染或者 JS 初始化 --> | |
| </select> | |
| <table id="result-table"> | |
| <thead> | |
| <tr> | |
| <th data-key="rank">Rank <span class="arrow">↑↓</span></th> | |
| <th data-key="algorithm">Algorithm <span class="arrow">↑↓</span></th> | |
| <th data-key="num_features">Num Features <span class="arrow">↑↓</span></th> | |
| <th data-key="mean_f1">Mean F1 <span class="arrow">↑↓</span></th> | |
| <th data-key="mean_auc">Mean AUC <span class="arrow">↑↓</span></th> | |
| <th data-key="time">Time <span class="arrow">↑↓</span></th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <!-- 数据行由 JS 填充 --> | |
| </tbody> | |
| </table> | |
| <script> | |
| // 全局变量存储当前表格数据 | |
| let currentResults = []; | |
| // 渲染表格 | |
| function updateTable(results) { | |
| const tbody = document.querySelector("#result-table tbody"); | |
| tbody.innerHTML = ""; | |
| currentResults = results; // 保存全局,用于排序 | |
| results.forEach((r, idx) => { | |
| const row = document.createElement("tr"); | |
| row.innerHTML = ` | |
| <td>${idx + 1}</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> | |
| `; | |
| tbody.appendChild(row); | |
| }); | |
| } | |
| // 获取数据 | |
| function fetchResults(dataset) { | |
| console.log("[DEBUG] Fetching dataset:", dataset); | |
| fetch(`/api/results?dataset=${dataset}`) | |
| .then(res => res.json()) | |
| .then(data => { | |
| console.log("[DEBUG] Fetched results:", data); | |
| updateTable(data); | |
| }) | |
| .catch(err => console.error(err)); | |
| } | |
| // 初始化下拉框和默认数据集 | |
| document.addEventListener("DOMContentLoaded", () => { | |
| const select = document.getElementById("dataset-select"); | |
| // 从后端获取可用数据集列表 | |
| fetch("/api/datasets") | |
| .then(res => res.json()) | |
| .then(datasets => { | |
| datasets.forEach(ds => { | |
| const option = document.createElement("option"); | |
| option.value = ds; | |
| option.textContent = ds; | |
| select.appendChild(option); | |
| }); | |
| // 默认加载 Authorship,如果存在 | |
| if (datasets.includes("Authorship")) { | |
| select.value = "Authorship"; | |
| fetchResults("Authorship"); | |
| } else if (datasets.length > 0) { | |
| select.value = datasets[0]; | |
| fetchResults(datasets[0]); | |
| } | |
| }); | |
| // 绑定选择事件 | |
| select.addEventListener("change", () => { | |
| fetchResults(select.value); | |
| }); | |
| // 绑定表头点击排序 | |
| document.querySelectorAll("#result-table th").forEach(th => { | |
| th.addEventListener("click", () => { | |
| const key = th.dataset.key; | |
| if (!key) return; | |
| sortTable(key); | |
| }); | |
| }); | |
| }); | |
| // 排序函数 | |
| let sortAsc = true; | |
| function sortTable(key) { | |
| currentResults.sort((a, b) => { | |
| let valA = a[key], valB = b[key]; | |
| // time 值越小越好,其余指标越大越好 | |
| if (key === "time") { | |
| return sortAsc ? valA - valB : valB - valA; | |
| } else { | |
| return sortAsc ? valB - valA : valA - valB; | |
| } | |
| }); | |
| // 切换排序方向 | |
| sortAsc = !sortAsc; | |
| updateTable(currentResults); | |
| } | |
| </script> | |
| </body> | |
| </html> | |