Fancy-yousa commited on
Commit
94e0fc9
·
verified ·
1 Parent(s): a5b0763

Upload 18 files

Browse files
AutoFS/Dockerfile ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9
2
+
3
+ WORKDIR /code
4
+
5
+ COPY ./requirements.txt /code/requirements.txt
6
+
7
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
8
+
9
+ COPY . /code
10
+
11
+ CMD ["python", "Webapp/app.py"]
AutoFS/README.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: AutoFS Leaderboard
3
+ emoji: 📊
4
+ colorFrom: blue
5
+ colorTo: green
6
+ sdk: docker
7
+ pinned: false
8
+ ---
9
+
10
+ # AutoFS Leaderboard
11
+
12
+ This is a visualization dashboard for AutoFS experiment results.
13
+
14
+ ## Deployment on Hugging Face Spaces
15
+
16
+ 1. Create a new Space on Hugging Face.
17
+ 2. Select "Docker" as the SDK.
18
+ 3. Upload all files from this repository.
19
+ 4. The application will automatically build and run.
20
+
21
+ ## Local Development
22
+
23
+ 1. Install dependencies:
24
+ ```bash
25
+ pip install -r requirements.txt
26
+ ```
27
+
28
+ 2. Run the application:
29
+ ```bash
30
+ python Webapp/app.py
31
+ ```
32
+
33
+ 3. Open http://localhost:5000 in your browser.
AutoFS/Webapp/__pycache__/app.cpython-39.pyc ADDED
Binary file (2.65 kB). View file
 
AutoFS/Webapp/app.py ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import sys
3
+ import pickle
4
+ import json
5
+ from flask import Flask, jsonify, request, render_template
6
+
7
+ # Add project root to sys.path to import leaderboard
8
+ sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
9
+ from leaderboard import rank_results
10
+ # ===============================
11
+ # 基本路径配置
12
+ # ===============================
13
+ PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
14
+ RESULT_DIR = os.path.join(PROJECT_ROOT, "results")
15
+ DATASET_DIR = os.path.join(PROJECT_ROOT, "datasets")
16
+
17
+ os.makedirs(RESULT_DIR, exist_ok=True)
18
+ os.makedirs(DATASET_DIR, exist_ok=True)
19
+
20
+ # ===============================
21
+ # Flask App
22
+ # ===============================
23
+ app = Flask(__name__)
24
+
25
+ # ===============================
26
+ # 内存缓存
27
+ # ===============================
28
+ RESULT_CACHE = {} # {dataset_name: results}
29
+
30
+
31
+ # ===============================
32
+ # PKL IO 工具
33
+ # ===============================
34
+ def save_result_json(dataset, results):
35
+ path = os.path.join(RESULT_DIR, f"{dataset}.json")
36
+ with open(path, "w", encoding='utf-8') as f:
37
+ json.dump(results, f, indent=4)
38
+
39
+
40
+ def load_result_json(dataset):
41
+ path = os.path.join(RESULT_DIR, f"{dataset}.json")
42
+ if not os.path.exists(path):
43
+ return None
44
+ with open(path, 'r', encoding='utf-8') as f:
45
+ return json.load(f)
46
+
47
+
48
+ def list_available_datasets():
49
+ datasets = set()
50
+
51
+ for f in os.listdir(RESULT_DIR):
52
+ if f.endswith(".json"):
53
+ datasets.add(f.replace(".json", ""))
54
+
55
+ # 默认展示数据集
56
+ datasets.add("Authorship")
57
+
58
+ return sorted(datasets)
59
+
60
+
61
+ # ===============================
62
+ # ⚠️ 你自己的 Agent 入口
63
+ # ===============================
64
+ def run_agent_for_dataset(dataset):
65
+ """
66
+ ⚠️ 用你自己的 router / agent 替换这里
67
+ 必须返回 List[Dict]
68
+ """
69
+ # ---------------------------
70
+ # 示例(占位)
71
+ # ---------------------------
72
+ return [
73
+
74
+ ]
75
+ # {
76
+ # "algorithm": "shibaile",
77
+ # "num_features": 15,
78
+ # "mean_f1": 0.9233716475,
79
+ # "mean_auc": 0.9816098520,
80
+ # "time": 5.75,
81
+ # "score": 0.9408431088,
82
+ # },
83
+ # {
84
+ # "algorithm": "JMchongxinzailai",
85
+ # "num_features": 15,
86
+ # "mean_f1": 0.918,
87
+ # "mean_auc": 0.979,
88
+ # "time": 7.32,
89
+ # "score": 0.932,
90
+ # },
91
+
92
+ # ===============================
93
+ # 页面
94
+ # ===============================
95
+ @app.route("/")
96
+ def index():
97
+ return render_template(
98
+ "index.html",
99
+ datasets=list_available_datasets(),
100
+ default_dataset="Authorship",
101
+ )
102
+
103
+
104
+ # ===============================
105
+ # API:获取结果
106
+ # ===============================
107
+ @app.route("/api/results")
108
+ def get_results():
109
+ dataset = request.args.get("dataset", "Authorship")
110
+
111
+ # ① 内存缓存 (Disabled for debugging)
112
+ # if dataset in RESULT_CACHE:
113
+ # print("------------------------------------------------------------------zoude cache")
114
+ # return jsonify(RESULT_CACHE[dataset])
115
+
116
+ # ② 磁盘 pkl/json
117
+ results = load_result_json(dataset)
118
+ print(111,results)
119
+ if results is not None:
120
+ print("------------------------------------------------------------------zoude json\n",results)
121
+ RESULT_CACHE[dataset] = results
122
+ leaderboard = rank_results(results)
123
+ return jsonify(leaderboard)
124
+
125
+ # ③ Agent 实时运行
126
+ results = run_agent_for_dataset(dataset)
127
+ print(222,results)
128
+
129
+ # ④ 存储
130
+ if results and len(results) > 0:
131
+ save_result_json(dataset, results)
132
+ RESULT_CACHE[dataset] = results
133
+
134
+ print("------------------------------------------------------------------zoude agent")
135
+ leaderboard = rank_results(results)
136
+ #
137
+ return jsonify(leaderboard)
138
+ # print(333,leaderboard)
139
+ # @app.route("/api/results")
140
+ # def get_results():
141
+ dataset = request.args.get("dataset", "Authorship")
142
+
143
+ print(f"[DEBUG] request dataset = {dataset}")
144
+
145
+ if dataset in RESULT_CACHE:
146
+ print("[DEBUG] hit memory cache")
147
+ return jsonify(RESULT_CACHE[dataset])
148
+
149
+ results = load_result_pkl(dataset)
150
+ if results is not None:
151
+ print("[DEBUG] hit pkl cache")
152
+ RESULT_CACHE[dataset] = results
153
+ return jsonify(results)
154
+
155
+ print("[DEBUG] run agent")
156
+ results = run_agent_for_dataset(dataset)
157
+ print("[DEBUG] agent results =", results)
158
+
159
+ save_result_pkl(dataset, results)
160
+ RESULT_CACHE[dataset] = results
161
+ return jsonify(results)
162
+
163
+
164
+ # ===============================
165
+ # API:数据集列表
166
+ # ===============================
167
+ @app.route("/api/datasets")
168
+ def api_datasets():
169
+ return jsonify(list_available_datasets())
170
+
171
+
172
+ if __name__ == "__main__":
173
+ port = int(os.environ.get("PORT", 5000))
174
+ app.run(host="0.0.0.0", port=port, debug=True)
AutoFS/Webapp/app1.py ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import pickle
3
+ from flask import Flask, jsonify, request, render_template
4
+
5
+ # ===============================
6
+ # 基本路径配置
7
+ # ===============================
8
+ PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
9
+ RESULT_DIR = os.path.join(PROJECT_ROOT, "results")
10
+ DATASET_DIR = os.path.join(PROJECT_ROOT, "datasets")
11
+
12
+ os.makedirs(RESULT_DIR, exist_ok=True)
13
+ os.makedirs(DATASET_DIR, exist_ok=True)
14
+
15
+ # ===============================
16
+ # Flask App
17
+ # ===============================
18
+ app = Flask(__name__)
19
+
20
+ # ===============================
21
+ # 内存缓存
22
+ # ===============================
23
+ RESULT_CACHE = {} # {dataset_name: results}
24
+
25
+
26
+ # ===============================
27
+ # PKL IO 工具
28
+ # ===============================
29
+ def save_result_pkl(dataset, results):
30
+ path = os.path.join(RESULT_DIR, f"{dataset}.pkl")
31
+ with open(path, "wb") as f:
32
+ pickle.dump(results, f)
33
+
34
+
35
+ def load_result_pkl(dataset):
36
+ path = os.path.join(RESULT_DIR, f"{dataset}.pkl")
37
+ if not os.path.exists(path):
38
+ return None
39
+ with open(path, "rb") as f:
40
+ return pickle.load(f)
41
+
42
+
43
+ def list_available_datasets():
44
+ datasets = set()
45
+
46
+ for f in os.listdir(RESULT_DIR):
47
+ if f.endswith(".pkl"):
48
+ datasets.add(f.replace(".pkl", ""))
49
+
50
+ # 默认展示数据集
51
+ datasets.add("Authorship")
52
+
53
+ return sorted(datasets)
54
+
55
+
56
+ # ===============================
57
+ # ⚠️ 你自己的 Agent 入口
58
+ # ===============================
59
+ def run_agent_for_dataset(dataset):
60
+ """
61
+ ⚠️ 用你自己的 router / agent 替换这里
62
+ 必须返回 List[Dict]
63
+ """
64
+ # ---------------------------
65
+ # 示例(占位)
66
+ # ---------------------------
67
+ return [
68
+ {
69
+ "algorithm": "UCRFS",
70
+ "num_features": 15,
71
+ "mean_f1": 0.9233716475,
72
+ "mean_auc": 0.9816098520,
73
+ "time": 5.75,
74
+ "score": 0.9408431088,
75
+ },
76
+ {
77
+ "algorithm": "JMIM",
78
+ "num_features": 15,
79
+ "mean_f1": 0.918,
80
+ "mean_auc": 0.979,
81
+ "time": 7.32,
82
+ "score": 0.932,
83
+ },
84
+ ]
85
+
86
+
87
+ # ===============================
88
+ # 页面
89
+ # ===============================
90
+ @app.route("/")
91
+ def index():
92
+ return render_template(
93
+ "index.html",
94
+ datasets=list_available_datasets(),
95
+ default_dataset="Authorship",
96
+ )
97
+
98
+
99
+ # ===============================
100
+ # API:获取结果
101
+ # ===============================
102
+ @app.route("/api/results")
103
+ def get_results():
104
+ dataset = request.args.get("dataset", "Authorship")
105
+
106
+ # ① 内存缓存
107
+ if dataset in RESULT_CACHE:
108
+ rank_results = jsonify(RESULT_CACHE[dataset])
109
+
110
+ # ② 磁盘 pkl
111
+ results = load_result_pkl(dataset)
112
+ if results is not None:
113
+ RESULT_CACHE[dataset] = results
114
+ rank_results = jsonify(results)
115
+
116
+ # ③ Agent 实时运行
117
+ results = run_agent_for_dataset(dataset)
118
+
119
+ # ④ 存储
120
+ save_result_pkl(dataset, results)
121
+ RESULT_CACHE[dataset] = results
122
+
123
+ rank_results = jsonify(results)
124
+ leaderboard = rank_results(rank_results)
125
+ return leaderboard
126
+ # @app.route("/api/results")
127
+ # def get_results():
128
+ dataset = request.args.get("dataset", "Authorship")
129
+
130
+ print(f"[DEBUG] request dataset = {dataset}")
131
+
132
+ if dataset in RESULT_CACHE:
133
+ print("[DEBUG] hit memory cache")
134
+ return jsonify(RESULT_CACHE[dataset])
135
+
136
+ results = load_result_pkl(dataset)
137
+ if results is not None:
138
+ print("[DEBUG] hit pkl cache")
139
+ RESULT_CACHE[dataset] = results
140
+ return jsonify(results)
141
+
142
+ print("[DEBUG] run agent")
143
+ results = run_agent_for_dataset(dataset)
144
+ print("[DEBUG] agent results =", results)
145
+
146
+ save_result_pkl(dataset, results)
147
+ RESULT_CACHE[dataset] = results
148
+ return jsonify(results)
149
+
150
+
151
+ # ===============================
152
+ # API:数据集列表
153
+ # ===============================
154
+ @app.route("/api/datasets")
155
+ def api_datasets():
156
+ return jsonify(list_available_datasets())
157
+
158
+
159
+ if __name__ == "__main__":
160
+ app.run(debug=True)
AutoFS/Webapp/app11.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pickle
2
+ from flask import Flask, render_template
3
+ from leaderboard import rank_results
4
+
5
+ app = Flask(__name__)
6
+
7
+ # 🚀 这里直接接你 Agent 跑完的 results
8
+ def get_results(dataname):
9
+ # with open("/home/fangsensen/AutoFS/results/"+ dataname +".pkl", "rb") as f:
10
+ # results = pickle.load(f)
11
+ # print(1111111111,results)
12
+ results = [{'selected_features': [59, 50, 56, 4, 38, 9, 29, 23, 0, 20, 34, 36, 24, 26, 28], 'num_features': 15, 'metrics': {'nb': {'f1': 0.9181133571145461, 'auc': 0.9807805770573524}, 'svm': {'f1': 0.9282600079270711, 'auc': 0.980695564275392}, 'rf': {'f1': 0.9219976218787156, 'auc': 0.9768409098650539}}, 'time': 9.468129634857178, 'algorithm': 'JMIM'}, {'selected_features': [59, 50, 56, 4, 38, 0, 9, 29, 23, 20, 36, 34, 24, 28, 26], 'num_features': 15, 'metrics': {'nb': {'f1': 0.9163694015061433, 'auc': 0.9805189493459717}, 'svm': {'f1': 0.9265953230281413, 'auc': 0.98064247666047}, 'rf': {'f1': 0.9189853349187476, 'auc': 0.9769432925613145}}, 'time': 1.5439717769622803, 'algorithm': 'CFR'}, {'selected_features': [59, 64, 63, 22, 26, 11, 49, 7, 18, 24, 28, 12, 0, 8, 45], 'num_features': 15, 'metrics': {'nb': {'f1': 0.8498612762584224, 'auc': 0.9612941645198875}, 'svm': {'f1': 0.8672215616329766, 'auc': 0.9669919810144432}, 'rf': {'f1': 0.8516052318668254, 'auc': 0.9579325242146627}}, 'time': 3.4254932403564453, 'algorithm': 'DCSF'}, {'selected_features': [69, 59, 9, 4, 38, 24, 0, 49, 26, 18, 28, 11, 66, 12, 7], 'num_features': 15, 'metrics': {'nb': {'f1': 0.8747522790328972, 'auc': 0.968331958034509}, 'svm': {'f1': 0.8916369401506141, 'auc': 0.9765525653706246}, 'rf': {'f1': 0.9151010701545778, 'auc': 0.9804838761712887}}, 'time': 2.531461477279663, 'algorithm': 'IWFS'}, {'selected_features': [59, 50, 4, 38, 24, 0, 56, 26, 29, 49, 28, 23, 34, 36, 20], 'num_features': 15, 'metrics': {'nb': {'f1': 0.8806183115338884, 'auc': 0.973024320439098}, 'svm': {'f1': 0.9082837891399126, 'auc': 0.9784503098286724}, 'rf': {'f1': 0.897661514070551, 'auc': 0.9735557096666029}}, 'time': 2.793144941329956, 'algorithm': 'MRI'}, {'selected_features': [59, 69, 9, 5, 10, 31, 36, 20, 33, 47, 22, 29, 44, 56, 8], 'num_features': 15, 'metrics': {'nb': {'f1': 0.911375346809354, 'auc': 0.979648928949016}, 'svm': {'f1': 0.9064605628220372, 'auc': 0.9782951525850493}, 'rf': {'f1': 0.9252477209671027, 'auc': 0.9822236522028844}}, 'time': 2.9142298698425293, 'algorithm': 'MRMD'}, {'selected_features': [59, 69, 9, 56, 29, 50, 36, 4, 38, 0, 20, 24, 23, 28, 34], 'num_features': 15, 'metrics': {'nb': {'f1': 0.9177962742766549, 'auc': 0.9819010381640604}, 'svm': {'f1': 0.9178755449861277, 'auc': 0.980385760789456}, 'rf': {'f1': 0.9344431232659534, 'auc': 0.9825427569391104}}, 'time': 5.751329660415649, 'algorithm': 'UCRFS'}, {'selected_features': [[23, 15, 69, 43, 9, 52, 33, 8, 5, 3, 59, 47, 34, 55, 36], [50, 16, 31, 44, 47, 9, 69, 42, 33, 36, 63, 65, 23, 20, 22], [29, 13, 38, 3, 28, 59, 56, 69, 26, 20, 34, 50, 14, 49, 36], [59, 19, 20, 36, 24, 29, 9, 10, 23, 28, 22, 8, 56, 0, 60]], 'num_features': [15, 15, 15, 15], 'union_num_features': 4, 'metrics': {'nb': {'f1': 0.879587792310741, 'auc': 0.9680606961937624}, 'svm': {'f1': 0.8917162108600871, 'auc': 0.9710497573464302}, 'rf': {'f1': 0.8789536266349584, 'auc': 0.9655313327795009}}, 'time': 14.973412275314331, 'algorithm': 'CSMDCCMR'}]
13
+ leaderboard = rank_results(results)
14
+ # print(222222222222222,leaderboard)
15
+ return leaderboard
16
+
17
+
18
+ @app.route("/")
19
+ def index():
20
+ dataname = 'Authorship'
21
+ results = get_results(dataname)
22
+ leaderboard = rank_results(results)
23
+ return render_template("index.html", leaderboard=leaderboard)
24
+
25
+
26
+ if __name__ == "__main__":
27
+ app.run(debug=True)
AutoFS/Webapp/templates/index.html ADDED
@@ -0,0 +1,603 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>AutoFS Leaderboard</title>
7
+ <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
8
+ <style>
9
+ :root {
10
+ --primary-color: #3498db;
11
+ --secondary-color: #2c3e50;
12
+ --background-color: #f8f9fa;
13
+ --text-color: #333;
14
+ --border-color: #dee2e6;
15
+ --hover-color: #f1f1f1;
16
+ }
17
+
18
+ body {
19
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
20
+ margin: 0;
21
+ padding: 20px;
22
+ background-color: var(--background-color);
23
+ color: var(--text-color);
24
+ }
25
+
26
+ .container {
27
+ max-width: 1200px;
28
+ margin: 0 auto;
29
+ background: white;
30
+ padding: 20px;
31
+ border-radius: 8px;
32
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
33
+ }
34
+
35
+ header {
36
+ display: flex;
37
+ justify-content: space-between;
38
+ align-items: center;
39
+ margin-bottom: 20px;
40
+ border-bottom: 2px solid var(--primary-color);
41
+ padding-bottom: 10px;
42
+ }
43
+
44
+ h1 {
45
+ margin: 0;
46
+ color: var(--secondary-color);
47
+ }
48
+
49
+ .controls {
50
+ display: flex;
51
+ gap: 10px;
52
+ align-items: center;
53
+ }
54
+
55
+ select {
56
+ padding: 8px 12px;
57
+ border: 1px solid var(--border-color);
58
+ border-radius: 4px;
59
+ font-size: 14px;
60
+ }
61
+
62
+ table {
63
+ width: 100%;
64
+ border-collapse: collapse;
65
+ margin-top: 10px;
66
+ }
67
+
68
+ th, td {
69
+ padding: 12px 15px;
70
+ text-align: left;
71
+ border-bottom: 1px solid var(--border-color);
72
+ }
73
+
74
+ th {
75
+ background-color: var(--secondary-color);
76
+ color: white;
77
+ cursor: pointer;
78
+ user-select: none;
79
+ position: sticky;
80
+ top: 0;
81
+ }
82
+
83
+ th:hover {
84
+ background-color: #34495e;
85
+ }
86
+
87
+ th .arrow {
88
+ font-size: 10px;
89
+ margin-left: 5px;
90
+ opacity: 0.7;
91
+ }
92
+
93
+ tr:hover {
94
+ background-color: var(--hover-color);
95
+ }
96
+
97
+ .score-bar {
98
+ height: 6px;
99
+ background-color: #e9ecef;
100
+ border-radius: 3px;
101
+ overflow: hidden;
102
+ margin-top: 5px;
103
+ }
104
+
105
+ .score-fill {
106
+ height: 100%;
107
+ background-color: var(--primary-color);
108
+ }
109
+
110
+ .features-cell {
111
+ max-width: 200px;
112
+ white-space: nowrap;
113
+ overflow: hidden;
114
+ text-overflow: ellipsis;
115
+ color: #666;
116
+ font-size: 0.9em;
117
+ cursor: pointer;
118
+ }
119
+
120
+ .features-cell:hover {
121
+ text-decoration: underline;
122
+ color: var(--primary-color);
123
+ }
124
+
125
+ /* Modal styles */
126
+ .modal {
127
+ display: none;
128
+ position: fixed;
129
+ z-index: 1000;
130
+ left: 0;
131
+ top: 0;
132
+ width: 100%;
133
+ height: 100%;
134
+ background-color: rgba(0,0,0,0.5);
135
+ }
136
+
137
+ .modal-content {
138
+ background-color: white;
139
+ margin: 10% auto;
140
+ padding: 20px;
141
+ border-radius: 8px;
142
+ width: 50%;
143
+ max-width: 600px;
144
+ box-shadow: 0 4px 6px rgba(0,0,0,0.1);
145
+ }
146
+
147
+ .close {
148
+ color: #aaa;
149
+ float: right;
150
+ font-size: 28px;
151
+ font-weight: bold;
152
+ cursor: pointer;
153
+ }
154
+
155
+ .close:hover {
156
+ color: black;
157
+ }
158
+
159
+ .feature-tag {
160
+ display: inline-block;
161
+ background-color: #e1ecf4;
162
+ color: #2c3e50;
163
+ padding: 4px 8px;
164
+ border-radius: 4px;
165
+ margin: 2px;
166
+ font-size: 0.9em;
167
+ }
168
+
169
+ .loading {
170
+ text-align: center;
171
+ padding: 20px;
172
+ color: #666;
173
+ }
174
+ </style>
175
+ </head>
176
+ <body>
177
+
178
+ <div class="container">
179
+ <header>
180
+ <h1>🏆 AutoFS Leaderboard</h1>
181
+ <div class="controls">
182
+ <label for="dataset-select">Dataset:</label>
183
+ <select id="dataset-select">
184
+ <option value="" disabled selected>Loading...</option>
185
+ </select>
186
+ </div>
187
+ </header>
188
+
189
+ <div id="loading-indicator" class="loading" style="display: none;">Loading data...</div>
190
+
191
+ <div class="chart-controls" style="text-align:center; margin-top: 20px; margin-bottom: 15px;">
192
+ <label style="margin-right:15px; font-weight:bold;">View Mode:</label>
193
+ <input type="radio" id="view-overall" name="chart-view" value="overall" checked onchange="updateView()">
194
+ <label for="view-overall" style="margin-right:10px;">Overall (Mean)</label>
195
+
196
+ <input type="radio" id="view-classifiers-f1" name="chart-view" value="classifiers-f1" onchange="updateView()">
197
+ <label for="view-classifiers-f1" style="margin-right:10px;">F1 by Classifier</label>
198
+
199
+ <input type="radio" id="view-classifiers-auc" name="chart-view" value="classifiers-auc" onchange="updateView()">
200
+ <label for="view-classifiers-auc">AUC by Classifier</label>
201
+ </div>
202
+
203
+ <div class="charts-container" style="display: flex; gap: 20px; margin-bottom: 20px;">
204
+ <div style="flex: 1; background: white; padding: 15px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1);">
205
+ <canvas id="scoreChart"></canvas>
206
+ </div>
207
+ <div style="flex: 1; background: white; padding: 15px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1);">
208
+ <canvas id="timeChart"></canvas>
209
+ </div>
210
+ </div>
211
+
212
+ <table id="result-table">
213
+ <thead>
214
+ <!-- Headers generated dynamically -->
215
+ </thead>
216
+ <tbody>
217
+ <!-- Data rows will be populated here -->
218
+ </tbody>
219
+ </table>
220
+ </div>
221
+
222
+ <!-- Modal for details -->
223
+ <div id="details-modal" class="modal">
224
+ <div class="modal-content">
225
+ <span class="close">&times;</span>
226
+ <h2 id="modal-title">Algorithm Details</h2>
227
+ <div id="modal-body"></div>
228
+ </div>
229
+ </div>
230
+
231
+ <script>
232
+ let currentResults = [];
233
+ let sortDirection = 1; // 1 for asc, -1 for desc
234
+ let lastSortKey = '';
235
+
236
+ const VIEW_CONFIG = {
237
+ 'overall': [
238
+ { key: 'mean_f1', label: 'Mean F1' },
239
+ { key: 'mean_auc', label: 'Mean AUC' }
240
+ ],
241
+ 'classifiers-f1': [
242
+ { key: 'metrics.nb.f1', label: 'NB F1' },
243
+ { key: 'metrics.svm.f1', label: 'SVM F1' },
244
+ { key: 'metrics.rf.f1', label: 'RF F1' }
245
+ ],
246
+ 'classifiers-auc': [
247
+ { key: 'metrics.nb.auc', label: 'NB AUC' },
248
+ { key: 'metrics.svm.auc', label: 'SVM AUC' },
249
+ { key: 'metrics.rf.auc', label: 'RF AUC' }
250
+ ]
251
+ };
252
+
253
+ const tableHead = document.querySelector("#result-table thead");
254
+ const tableBody = document.querySelector("#result-table tbody");
255
+ const datasetSelect = document.getElementById("dataset-select");
256
+ const loadingIndicator = document.getElementById("loading-indicator");
257
+ const modal = document.getElementById("details-modal");
258
+ const closeModal = document.querySelector(".close");
259
+
260
+ // Close modal
261
+ closeModal.onclick = () => modal.style.display = "none";
262
+ window.onclick = (event) => {
263
+ if (event.target == modal) modal.style.display = "none";
264
+ }
265
+
266
+ // Global chart instances
267
+ let scoreChartInstance = null;
268
+ let timeChartInstance = null;
269
+
270
+ function updateCharts(results) {
271
+ if (!Array.isArray(results) || results.length === 0) return;
272
+
273
+ // Limit to top 15 for readability
274
+ const topResults = results.slice(0, 15);
275
+ const labels = topResults.map(r => r.algorithm || 'Unknown');
276
+ const times = topResults.map(r => r.time || 0);
277
+
278
+ const viewMode = document.querySelector('input[name="chart-view"]:checked').value;
279
+ let datasets = [];
280
+
281
+ if (viewMode === 'overall') {
282
+ const f1Scores = topResults.map(r => r.mean_f1 || 0);
283
+ const aucScores = topResults.map(r => r.mean_auc || 0);
284
+ datasets = [
285
+ {
286
+ label: 'Mean F1',
287
+ data: f1Scores,
288
+ backgroundColor: 'rgba(52, 152, 219, 0.7)',
289
+ borderColor: 'rgba(52, 152, 219, 1)',
290
+ borderWidth: 1
291
+ },
292
+ {
293
+ label: 'Mean AUC',
294
+ data: aucScores,
295
+ backgroundColor: 'rgba(46, 204, 113, 0.7)',
296
+ borderColor: 'rgba(46, 204, 113, 1)',
297
+ borderWidth: 1
298
+ }
299
+ ];
300
+ } else if (viewMode === 'classifiers-f1') {
301
+ const classifiers = ['nb', 'svm', 'rf'];
302
+ const colors = ['rgba(255, 206, 86, 0.5)', 'rgba(75, 192, 192, 0.5)', 'rgba(153, 102, 255, 0.5)'];
303
+ const borderColors = ['rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)', 'rgba(153, 102, 255, 1)'];
304
+
305
+ datasets = classifiers.map((cls, idx) => ({
306
+ label: cls.toUpperCase() + ' F1',
307
+ data: topResults.map(r => (r.metrics && r.metrics[cls]) ? r.metrics[cls].f1 : 0),
308
+ backgroundColor: colors[idx],
309
+ borderColor: borderColors[idx],
310
+ borderWidth: 1
311
+ }));
312
+ } else if (viewMode === 'classifiers-auc') {
313
+ const classifiers = ['nb', 'svm', 'rf'];
314
+ const colors = ['rgba(255, 206, 86, 0.5)', 'rgba(75, 192, 192, 0.5)', 'rgba(153, 102, 255, 0.5)'];
315
+ const borderColors = ['rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)', 'rgba(153, 102, 255, 1)'];
316
+
317
+ datasets = classifiers.map((cls, idx) => ({
318
+ label: cls.toUpperCase() + ' AUC',
319
+ data: topResults.map(r => (r.metrics && r.metrics[cls]) ? r.metrics[cls].auc : 0),
320
+ backgroundColor: colors[idx],
321
+ borderColor: borderColors[idx],
322
+ borderWidth: 1
323
+ }));
324
+ }
325
+
326
+ // Score Chart
327
+ const scoreCtx = document.getElementById('scoreChart').getContext('2d');
328
+ if (scoreChartInstance) scoreChartInstance.destroy();
329
+
330
+ scoreChartInstance = new Chart(scoreCtx, {
331
+ type: 'bar',
332
+ data: {
333
+ labels: labels,
334
+ datasets: datasets
335
+ },
336
+ options: {
337
+ responsive: true,
338
+ maintainAspectRatio: false,
339
+ plugins: {
340
+ title: {
341
+ display: true,
342
+ text: viewMode === 'overall' ? 'Top Algorithms Performance (Mean)' :
343
+ (viewMode === 'classifiers-f1' ? 'F1-Score by Classifier' : 'AUC by Classifier')
344
+ }
345
+ },
346
+ scales: {
347
+ y: {
348
+ beginAtZero: false,
349
+ // min: 0.8
350
+ }
351
+ }
352
+ }
353
+ });
354
+
355
+ // Time Chart
356
+ const timeCtx = document.getElementById('timeChart').getContext('2d');
357
+ if (timeChartInstance) timeChartInstance.destroy();
358
+
359
+ timeChartInstance = new Chart(timeCtx, {
360
+ type: 'line',
361
+ data: {
362
+ labels: labels,
363
+ datasets: [{
364
+ label: 'Time (s)',
365
+ data: times,
366
+ backgroundColor: 'rgba(231, 76, 60, 0.2)',
367
+ borderColor: 'rgba(231, 76, 60, 1)',
368
+ borderWidth: 2,
369
+ tension: 0.3,
370
+ fill: true
371
+ }]
372
+ },
373
+ options: {
374
+ responsive: true,
375
+ maintainAspectRatio: false,
376
+ plugins: {
377
+ title: { display: true, text: 'Execution Time' }
378
+ },
379
+ scales: {
380
+ y: { beginAtZero: true }
381
+ }
382
+ }
383
+ });
384
+ }
385
+
386
+ function showDetails(result) {
387
+ const title = document.getElementById("modal-title");
388
+ const body = document.getElementById("modal-body");
389
+
390
+ title.textContent = `${result.algorithm} Details`;
391
+
392
+ let featuresHtml = result.selected_features.map(f =>
393
+ `<span class="feature-tag">${f}</span>`
394
+ ).join('');
395
+
396
+ let metricsHtml = '<div style="margin-top: 15px;"><h3>Metrics Breakdown</h3>';
397
+ for (const [clf, m] of Object.entries(result.metrics || {})) {
398
+ metricsHtml += `
399
+ <div style="margin-bottom: 10px;">
400
+ <strong>${clf.toUpperCase()}:</strong>
401
+ F1: ${m.f1.toFixed(4)}, AUC: ${m.auc.toFixed(4)}
402
+ </div>`;
403
+ }
404
+ metricsHtml += '</div>';
405
+
406
+ body.innerHTML = `
407
+ <p><strong>Time:</strong> ${result.time.toFixed(4)}s</p>
408
+ <p><strong>Num Features:</strong> ${result.num_features}</p>
409
+ <p><strong>Selected Features (${result.selected_features.length}):</strong></p>
410
+ <div>${featuresHtml}</div>
411
+ ${metricsHtml}
412
+ `;
413
+
414
+ modal.style.display = "block";
415
+ }
416
+
417
+ function getValue(obj, path) {
418
+ if (!path) return undefined;
419
+ return path.split('.').reduce((acc, part) => (acc && acc[part] !== undefined) ? acc[part] : undefined, obj);
420
+ }
421
+
422
+ function safeFixed(value, digits=4) {
423
+ if (value === undefined || value === null) return 'N/A';
424
+ return Number(value).toFixed(digits);
425
+ }
426
+
427
+ function renderTableHeader() {
428
+ const viewMode = document.querySelector('input[name="chart-view"]:checked').value;
429
+ const dynamicCols = VIEW_CONFIG[viewMode] || VIEW_CONFIG['overall'];
430
+
431
+ let html = '<tr>';
432
+ html += '<th data-key="rank" style="width: 60px;">#</th>';
433
+ html += '<th data-key="algorithm">Algorithm <span class="arrow">↕</span></th>';
434
+
435
+ dynamicCols.forEach(col => {
436
+ html += `<th data-key="${col.key}">${col.label} <span class="arrow">↕</span></th>`;
437
+ });
438
+
439
+ html += '<th data-key="time">Time (s) <span class="arrow">↕</span></th>';
440
+ html += '<th data-key="selected_features">Selected Features</th>';
441
+ html += '</tr>';
442
+
443
+ tableHead.innerHTML = html;
444
+
445
+ // Re-attach sort listeners
446
+ tableHead.querySelectorAll('th[data-key]').forEach(th => {
447
+ th.addEventListener('click', () => sortTable(th.dataset.key));
448
+ });
449
+ }
450
+
451
+ function updateTable(results) {
452
+ tableBody.innerHTML = "";
453
+
454
+ // Safety check
455
+ if (!Array.isArray(results)) {
456
+ tableBody.innerHTML = '<tr><td colspan="10" style="text-align:center; color:red;">Error: Invalid data format</td></tr>';
457
+ return;
458
+ }
459
+
460
+ if (results.length === 0) {
461
+ tableBody.innerHTML = '<tr><td colspan="10" style="text-align:center;">No results found</td></tr>';
462
+ return;
463
+ }
464
+
465
+ const viewMode = document.querySelector('input[name="chart-view"]:checked').value;
466
+ const dynamicCols = VIEW_CONFIG[viewMode] || VIEW_CONFIG['overall'];
467
+
468
+ results.forEach((r, idx) => {
469
+ const row = document.createElement("tr");
470
+
471
+ // Format features for preview
472
+ const featurePreview = (r.selected_features && Array.isArray(r.selected_features))
473
+ ? r.selected_features.slice(0, 5).join(', ') + (r.selected_features.length > 5 ? '...' : '')
474
+ : 'N/A';
475
+
476
+ let html = `<td>${idx + 1}</td>`;
477
+ html += `<td><strong>${r.algorithm || 'Unknown'}</strong></td>`;
478
+
479
+ dynamicCols.forEach(col => {
480
+ const val = getValue(r, col.key);
481
+ const score = val !== undefined ? val : 0;
482
+ html += `
483
+ <td>
484
+ ${safeFixed(val)}
485
+ <div class="score-bar"><div class="score-fill" style="width: ${Math.min(score * 100, 100)}%"></div></div>
486
+ </td>`;
487
+ });
488
+
489
+ const time = r.time || 0;
490
+ html += `<td>${safeFixed(time, 2)}</td>`;
491
+ html += `
492
+ <td class="features-cell" onclick="showDetails(currentResults[${idx}])" title="Click for details">
493
+ ${featurePreview} <span style="font-size:0.8em; color:#999;">(Click for details)</span>
494
+ </td>`;
495
+
496
+ row.innerHTML = html;
497
+ tableBody.appendChild(row);
498
+ });
499
+ }
500
+
501
+ function sortTable(key) {
502
+ if (lastSortKey === key) {
503
+ sortDirection *= -1;
504
+ } else {
505
+ sortDirection = key === 'time' || key === 'rank' ? 1 : -1;
506
+ lastSortKey = key;
507
+ }
508
+
509
+ // We don't call renderTableHeader here because it resets the sort indicators if we rebuild entirely.
510
+ // Instead, we just update the arrows.
511
+ document.querySelectorAll('th .arrow').forEach(span => span.textContent = '↕');
512
+ const activeHeader = document.querySelector(`th[data-key="${key}"] .arrow`);
513
+ if (activeHeader) activeHeader.textContent = sortDirection === 1 ? '↑' : '↓';
514
+
515
+ const sorted = [...currentResults].sort((a, b) => {
516
+ let valA = getValue(a, key);
517
+ let valB = getValue(b, key);
518
+
519
+ if (key === 'rank') return 0;
520
+
521
+ if (valA === undefined) valA = -Infinity;
522
+ if (valB === undefined) valB = -Infinity;
523
+
524
+ if (valA < valB) return -1 * sortDirection;
525
+ if (valA > valB) return 1 * sortDirection;
526
+ return 0;
527
+ });
528
+
529
+ // Don't update currentResults global if it breaks things, but here it's fine.
530
+ // Actually, let's keep currentResults as the master list?
531
+ // No, currentResults should be the sorted list for consistent subsequent sorts.
532
+ currentResults = sorted;
533
+ updateTable(sorted);
534
+ }
535
+
536
+ function updateView() {
537
+ renderTableHeader();
538
+ updateTable(currentResults);
539
+ updateCharts(currentResults);
540
+ }
541
+
542
+ function fetchResults(dataset) {
543
+ loadingIndicator.style.display = 'block';
544
+ tableBody.innerHTML = '';
545
+
546
+ console.log("Fetching results for:", dataset);
547
+ fetch(`/api/results?dataset=${dataset}`)
548
+ .then(res => {
549
+ if (!res.ok) throw new Error("Network response was not ok");
550
+ return res.json();
551
+ })
552
+ .then(data => {
553
+ console.log("Data received:", data);
554
+ currentResults = data;
555
+ updateView();
556
+ loadingIndicator.style.display = 'none';
557
+ })
558
+ .catch(err => {
559
+ console.error("Error fetching results:", err);
560
+ loadingIndicator.textContent = "Error loading data. Make sure the server is running.";
561
+ });
562
+ }
563
+
564
+ // Initialize
565
+ document.addEventListener("DOMContentLoaded", () => {
566
+ // Setup sort listeners
567
+ document.querySelectorAll('th[data-key]').forEach(th => {
568
+ th.addEventListener('click', () => sortTable(th.dataset.key));
569
+ });
570
+
571
+ // Load datasets
572
+ fetch("/api/datasets")
573
+ .then(res => res.json())
574
+ .then(datasets => {
575
+ datasetSelect.innerHTML = "";
576
+ datasets.forEach(ds => {
577
+ const option = document.createElement("option");
578
+ option.value = ds;
579
+ option.textContent = ds;
580
+ datasetSelect.appendChild(option);
581
+ });
582
+
583
+ if (datasets.includes("Authorship")) {
584
+ datasetSelect.value = "Authorship";
585
+ fetchResults("Authorship");
586
+ } else if (datasets.length > 0) {
587
+ datasetSelect.value = datasets[0];
588
+ fetchResults(datasets[0]);
589
+ }
590
+ })
591
+ .catch(err => {
592
+ console.error("Error fetching datasets:", err);
593
+ datasetSelect.innerHTML = "<option>Error loading datasets</option>";
594
+ });
595
+
596
+ datasetSelect.addEventListener('change', (e) => {
597
+ fetchResults(e.target.value);
598
+ });
599
+ });
600
+ </script>
601
+
602
+ </body>
603
+ </html>
AutoFS/Webapp/templates/index1.html ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>AutoFS Leaderboard</title>
6
+
7
+ <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
8
+
9
+ <style>
10
+ body {
11
+ font-family: Arial, sans-serif;
12
+ margin: 40px;
13
+ }
14
+
15
+ table {
16
+ border-collapse: collapse;
17
+ width: 100%;
18
+ }
19
+
20
+ th, td {
21
+ border: 1px solid #ddd;
22
+ padding: 10px;
23
+ text-align: center;
24
+ }
25
+
26
+ th {
27
+ cursor: pointer;
28
+ background-color: #f5f5f5;
29
+ user-select: none;
30
+ }
31
+
32
+ th span {
33
+ margin-left: 6px;
34
+ font-size: 12px;
35
+ opacity: 0.7;
36
+ }
37
+
38
+ tr:nth-child(even) {
39
+ background-color: #fafafa;
40
+ }
41
+
42
+ .chart-row {
43
+ display: flex;
44
+ gap: 40px;
45
+ margin-top: 40px;
46
+ }
47
+
48
+ .chart-container {
49
+ width: 50%;
50
+ }
51
+
52
+ .chart-row-single {
53
+ display: flex;
54
+ justify-content: center;
55
+ margin-top: 40px;
56
+ }
57
+
58
+ .chart-container-single {
59
+ width: 60%;
60
+ }
61
+ </style>
62
+ </head>
63
+ <body>
64
+
65
+ <h1>Feature Selection Leaderboard</h1>
66
+
67
+ <table>
68
+ <thead>
69
+ <tr>
70
+ <th>Rank</th>
71
+ <th onclick="sortTable('algorithm')">Algorithm <span id="arrow-algorithm">↕</span></th>
72
+ <th onclick="sortTable('num_features')">#Features <span id="arrow-num_features">↕</span></th>
73
+ <th onclick="sortTable('mean_f1')">Mean F1 <span id="arrow-mean_f1">↕</span></th>
74
+ <th onclick="sortTable('mean_auc')">Mean AUC <span id="arrow-mean_auc">↕</span></th>
75
+ <th onclick="sortTable('time')">Time (s) <span id="arrow-time">↕</span></th>
76
+ </tr>
77
+ </thead>
78
+ <tbody id="tbody"></tbody>
79
+ </table>
80
+
81
+ <!-- F1 & AUC -->
82
+ <div class="chart-row">
83
+ <div class="chart-container">
84
+ <canvas id="f1Chart"></canvas>
85
+ </div>
86
+ <div class="chart-container">
87
+ <canvas id="aucChart"></canvas>
88
+ </div>
89
+ </div>
90
+
91
+ <!-- Time -->
92
+ <div class="chart-row-single">
93
+ <div class="chart-container-single">
94
+ <canvas id="timeChart"></canvas>
95
+ </div>
96
+ </div>
97
+
98
+ <script>
99
+ let leaderboardData = {{ leaderboard | tojson }};
100
+ let sortKey = null;
101
+ let sortAsc = true;
102
+ let f1Chart, aucChart, timeChart;
103
+
104
+ const metricOrder = {
105
+ algorithm: "asc", // 字符串
106
+ num_features: "asc", // 少特征更好(你也可以改)
107
+ mean_f1: "desc", // 越大越好
108
+ mean_auc: "desc", // 越大越好
109
+ time: "asc" // 越小越好 ✅
110
+ };
111
+
112
+ function renderTable() {
113
+ const tbody = document.getElementById("tbody");
114
+ tbody.innerHTML = "";
115
+
116
+ const n = leaderboardData.length;
117
+
118
+ const isBestFirst =
119
+ (metricOrder[sortKey] === "desc" && !sortAsc) ||
120
+ (metricOrder[sortKey] === "asc" && sortAsc);
121
+
122
+ leaderboardData.forEach((r, i) => {
123
+ const rank = isBestFirst ? i + 1 : n - i;
124
+
125
+ tbody.insertAdjacentHTML("beforeend", `
126
+ <tr>
127
+ <td>${rank}</td>
128
+ <td>${r.algorithm}</td>
129
+ <td>${r.num_features}</td>
130
+ <td>${r.mean_f1.toFixed(4)}</td>
131
+ <td>${r.mean_auc.toFixed(4)}</td>
132
+ <td>${r.time.toFixed(2)}</td>
133
+ </tr>
134
+ `);
135
+ });
136
+ }
137
+
138
+ function sortTable(key) {
139
+ if (sortKey === key) {
140
+ sortAsc = !sortAsc;
141
+ } else {
142
+ sortKey = key;
143
+ sortAsc = metricOrder[key] === "asc";
144
+ }
145
+
146
+ leaderboardData.sort((a, b) => {
147
+ if (typeof a[key] === "string") {
148
+ return sortAsc
149
+ ? a[key].localeCompare(b[key])
150
+ : b[key].localeCompare(a[key]);
151
+ }
152
+ return sortAsc ? a[key] - b[key] : b[key] - a[key];
153
+ });
154
+
155
+ updateArrows();
156
+ renderTable();
157
+ updateCharts();
158
+ }
159
+
160
+ function updateArrows() {
161
+ document.querySelectorAll("th span").forEach(s => s.textContent = "↕");
162
+ document.getElementById("arrow-" + sortKey).textContent = sortAsc ? "↑" : "↓";
163
+ }
164
+
165
+ function updateCharts() {
166
+ const labels = leaderboardData.map(r => r.algorithm);
167
+
168
+ if (f1Chart) f1Chart.destroy();
169
+ if (aucChart) aucChart.destroy();
170
+ if (timeChart) timeChart.destroy();
171
+
172
+ const baseOptions = title => ({
173
+ responsive: true,
174
+ maintainAspectRatio: true,
175
+ aspectRatio: 2,
176
+ plugins: { title: { display: true, text: title } }
177
+ });
178
+
179
+ f1Chart = new Chart(document.getElementById("f1Chart"), {
180
+ type: "line",
181
+ data: {
182
+ labels,
183
+ datasets: [{ label: "Mean F1", data: leaderboardData.map(r => r.mean_f1) }]
184
+ },
185
+ options: baseOptions("Mean F1 Curve")
186
+ });
187
+
188
+ aucChart = new Chart(document.getElementById("aucChart"), {
189
+ type: "line",
190
+ data: {
191
+ labels,
192
+ datasets: [{ label: "Mean AUC", data: leaderboardData.map(r => r.mean_auc) }]
193
+ },
194
+ options: baseOptions("Mean AUC Curve")
195
+ });
196
+
197
+ timeChart = new Chart(document.getElementById("timeChart"), {
198
+ type: "line",
199
+ data: {
200
+ labels,
201
+ datasets: [{ label: "Time (s)", data: leaderboardData.map(r => r.time) }]
202
+ },
203
+ options: baseOptions("Runtime Curve")
204
+ });
205
+ }
206
+
207
+ renderTable();
208
+ updateCharts();
209
+ </script>
210
+
211
+ </body>
212
+ </html>
AutoFS/Webapp/templates/index11.html ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>Feature Selection Leaderboard</title>
6
+ <style>
7
+ body { font-family: Arial, sans-serif; margin: 20px; }
8
+ table { border-collapse: collapse; width: 100%; margin-top: 20px; }
9
+ th, td { border: 1px solid #ddd; padding: 8px; text-align: center; }
10
+ th { cursor: pointer; background-color: #f2f2f2; position: relative; }
11
+ th .arrow { font-size: 12px; margin-left: 4px; }
12
+ select { padding: 5px; margin-bottom: 10px; }
13
+ </style>
14
+ </head>
15
+ <body>
16
+
17
+ <h1>Feature Selection Leaderboard</h1>
18
+
19
+ <label for="dataset-select">Select Dataset:</label>
20
+ <select id="dataset-select">
21
+ <!-- 这里的 options 会在后端渲染或者 JS 初始化 -->
22
+ </select>
23
+
24
+ <table id="result-table">
25
+ <thead>
26
+ <tr>
27
+ <th data-key="rank">Rank <span class="arrow">↑↓</span></th>
28
+ <th data-key="algorithm">Algorithm <span class="arrow">↑↓</span></th>
29
+ <th data-key="num_features">Num Features <span class="arrow">↑↓</span></th>
30
+ <th data-key="mean_f1">Mean F1 <span class="arrow">↑↓</span></th>
31
+ <th data-key="mean_auc">Mean AUC <span class="arrow">↑↓</span></th>
32
+ <th data-key="time">Time <span class="arrow">↑↓</span></th>
33
+ </tr>
34
+ </thead>
35
+ <tbody>
36
+ <!-- 数据行由 JS 填充 -->
37
+ </tbody>
38
+ </table>
39
+
40
+ <script>
41
+ // 全局变量存储当前表格数据
42
+ let currentResults = [];
43
+
44
+ // 渲染表格
45
+ function updateTable(results) {
46
+ const tbody = document.querySelector("#result-table tbody");
47
+ tbody.innerHTML = "";
48
+ currentResults = results; // 保存全局,用于排序
49
+
50
+ results.forEach((r, idx) => {
51
+ const row = document.createElement("tr");
52
+ row.innerHTML = `
53
+ <td>${idx + 1}</td>
54
+ <td>${r.algorithm}</td>
55
+ <td>${r.num_features}</td>
56
+ <td>${r.mean_f1.toFixed(4)}</td>
57
+ <td>${r.mean_auc.toFixed(4)}</td>
58
+ <td>${r.time.toFixed(2)}</td>
59
+ `;
60
+ tbody.appendChild(row);
61
+ });
62
+ }
63
+
64
+ // 获取数据
65
+ function fetchResults(dataset) {
66
+ console.log("[DEBUG] Fetching dataset:", dataset);
67
+ fetch(`/api/results?dataset=${dataset}`)
68
+ .then(res => res.json())
69
+ .then(data => {
70
+ console.log("[DEBUG] Fetched results:", data);
71
+ updateTable(data);
72
+ })
73
+ .catch(err => console.error(err));
74
+ }
75
+
76
+ // 初始化下拉框和默认数据集
77
+ document.addEventListener("DOMContentLoaded", () => {
78
+ const select = document.getElementById("dataset-select");
79
+
80
+ // 从后端获取可用数据集列表
81
+ fetch("/api/datasets")
82
+ .then(res => res.json())
83
+ .then(datasets => {
84
+ datasets.forEach(ds => {
85
+ const option = document.createElement("option");
86
+ option.value = ds;
87
+ option.textContent = ds;
88
+ select.appendChild(option);
89
+ });
90
+
91
+ // 默认加载 Authorship,如果存在
92
+ if (datasets.includes("Authorship")) {
93
+ select.value = "Authorship";
94
+ fetchResults("Authorship");
95
+ } else if (datasets.length > 0) {
96
+ select.value = datasets[0];
97
+ fetchResults(datasets[0]);
98
+ }
99
+ });
100
+
101
+ // 绑定选择事件
102
+ select.addEventListener("change", () => {
103
+ fetchResults(select.value);
104
+ });
105
+
106
+ // 绑定表头点击排序
107
+ document.querySelectorAll("#result-table th").forEach(th => {
108
+ th.addEventListener("click", () => {
109
+ const key = th.dataset.key;
110
+ if (!key) return;
111
+ sortTable(key);
112
+ });
113
+ });
114
+ });
115
+
116
+ // 排序函数
117
+ let sortAsc = true;
118
+ function sortTable(key) {
119
+ currentResults.sort((a, b) => {
120
+ let valA = a[key], valB = b[key];
121
+
122
+ // time 值越小越好,其余指标越大越好
123
+ if (key === "time") {
124
+ return sortAsc ? valA - valB : valB - valA;
125
+ } else {
126
+ return sortAsc ? valB - valA : valA - valB;
127
+ }
128
+ });
129
+ // 切换排序方向
130
+ sortAsc = !sortAsc;
131
+ updateTable(currentResults);
132
+ }
133
+ </script>
134
+
135
+ </body>
136
+ </html>
AutoFS/Webapp/templates/indexa.html ADDED
@@ -0,0 +1,434 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html>
3
+
4
+ <head>
5
+ <title>FeatureSelect Leaderboard</title>
6
+
7
+ <!-- Google tag (gtag.js) -->
8
+ <!-- <script async src="https://www.googletagmanager.com/gtag/js?id=G-VWV023WWP4"></script> -->
9
+ <!-- <script>
10
+ window.dataLayer = window.dataLayer || [];
11
+
12
+ function gtag() {
13
+ dataLayer.push(arguments);
14
+ }
15
+
16
+ gtag('js', new Date());
17
+
18
+ gtag('config', 'G-VWV023WWP4');
19
+ </script> -->
20
+
21
+ <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
22
+ <link rel="icon" href="https://raw.githubusercontent.com/tatsu-lab/alpaca_eval/main/docs/AlpacaFarm_small.png">
23
+ <link href="https://cdn.jsdelivr.net/css-toggle-switch/latest/toggle-switch.css" rel="stylesheet"/>
24
+
25
+ <style>
26
+ body {
27
+ font-family: Arial, sans-serif;
28
+ margin: 0;
29
+ padding: 50px 20px;
30
+ background-color: #FFFFFF;
31
+ color: #000000;
32
+ }
33
+
34
+ .container {
35
+ max-width: 700px;
36
+ margin: auto;
37
+ }
38
+
39
+ #branding {
40
+ text-align: center;
41
+ margin-bottom: 20px;
42
+ }
43
+
44
+ #branding h1 {
45
+ margin: 0;
46
+ font-size: 2em;
47
+ }
48
+
49
+ h2 {
50
+ margin: 0;
51
+ font-size: 1.2em;
52
+ color: #777;
53
+ }
54
+
55
+ table {
56
+ max-width: 700px;
57
+ width: 100%;
58
+ table-layout: fixed;
59
+ margin: auto;
60
+ font-size: 1em;
61
+ }
62
+
63
+ table th,
64
+ table td {
65
+ padding: 6px;
66
+ word-wrap: break-word;
67
+ vertical-align: middle;
68
+ }
69
+
70
+ table th {
71
+ border-bottom: 2px solid #000;
72
+ }
73
+
74
+ th.rank, td.rank {
75
+ width: 9%; /* Adjust as needed */
76
+ padding-left: 10px; /* Small margin */
77
+ text-align: left;
78
+ }
79
+
80
+ th.name, td.name {
81
+ width: 55%;
82
+ padding-left: 30px;
83
+ text-align: left;
84
+ }
85
+
86
+ th:not(.rank):not(.name),
87
+ td:not(.rank):not(.name) {
88
+ text-align: right;
89
+ padding-right: 10px;
90
+ }
91
+
92
+ th.winRate, td.winRate {
93
+ width: 17%;
94
+ padding-right: 30px;
95
+ }
96
+
97
+ th {
98
+ text-align: right;
99
+ padding-bottom: 15px;
100
+ }
101
+
102
+ td {
103
+ padding-bottom: 10px;
104
+ }
105
+
106
+ #leaderboard tr th.winRate,
107
+ #leaderboard tr td.winRate {
108
+ color: #999999;
109
+ }
110
+
111
+ #leaderboard tr th.rank,
112
+ #leaderboard tr td.rank {
113
+ color: #999999;
114
+ }
115
+
116
+ table tr:nth-child(even) {
117
+ background-color: #E8E8E8;
118
+ }
119
+
120
+ table tr:nth-child(odd) {
121
+ background-color: #F8F8F8;
122
+ }
123
+
124
+ .switch-toggle {
125
+ display: inline-block;
126
+ vertical-align: middle;
127
+ }
128
+
129
+ .switch-toggle input + label {
130
+ padding: 2px;
131
+ padding-left: 7px;
132
+ padding-right: 7px;
133
+ cursor: pointer;
134
+ background-color: lightgrey;
135
+ border: 1px solid transparent;
136
+ font-size: 16px;
137
+ }
138
+
139
+ .switch-toggle input:checked + label {
140
+ border-color: green;
141
+ color: green;
142
+ }
143
+
144
+ .switch-toggle input:not(:checked) + label {
145
+ color: black;
146
+ box-shadow: none !important;
147
+ user-select: none;
148
+ }
149
+
150
+
151
+ .toggle-line {
152
+ display: flex;
153
+ justify-content: center;
154
+ align-items: center;
155
+ margin-bottom: 20px;
156
+ font-size: 17px;
157
+ }
158
+
159
+ .toggle-line .switch-toggle {
160
+ margin: 0 10px;
161
+ }
162
+ </style>
163
+ <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/PapaParse/5.3.0/papaparse.min.js"></script> -->
164
+ </head>
165
+
166
+ <body>
167
+ <div class="container">
168
+ <div id="branding">
169
+
170
+ <h1>FeatureSelect
171
+ <!-- <a href="https://github.com/tatsu-lab/alpaca_eval/tree/main">
172
+ <img src="https://raw.githubusercontent.com/tatsu-lab/alpaca_eval/main/docs/AlpacaFarm_small.png"
173
+ alt="Logo" style="height: 2em; vertical-align: middle;"></a> -->
174
+ Leaderboard
175
+ </h1>
176
+ <br>
177
+ <h2>An Automatic Evaluator for FeatureSelect Methods</h2>
178
+ <!-- <small id="alpaca_eval_info" style="color: #777;">-->
179
+ <!-- Baseline: GPT-4 Preview &nbsp; | &nbsp; Auto-annotator: GPT-4 Preview-->
180
+ <!-- </small>-->
181
+ <!-- <br>-->
182
+ <small id="caution" style="color: #8C1515;">
183
+ <b> Length-controlled</b> (LC) win rates alleviate length biases of GPT-4, but it may favor models finetuned on its outputs.
184
+ </small>
185
+ <br>
186
+ <a href="https://github.com/Fss2652530458/AutoFS">
187
+ <img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" alt="GitHub logo" style="height: 1.5em;/* margin-bottom: 0; */">
188
+ </a>
189
+ </div>
190
+
191
+
192
+ <!-- 选择器 -->
193
+ <div class="toggle-line">
194
+
195
+ Version:
196
+ <div class="switch-toggle switch-evaluator" style="margin-right: 4em">
197
+ <input id="alpaca_eval" name="version" type="radio"/>
198
+ <label for="alpaca_eval" onclick="">AlpacaEval</label>
199
+ <input id="alpaca_eval_2" name="version" type="radio" checked="checked"/>
200
+ <label for="alpaca_eval_2" onclick="">AlpacaEval 2.0</label>
201
+ </div>
202
+
203
+ Filter:
204
+ <div class="switch-toggle switch-filter">
205
+ <input id="community" name="filter" type="radio"/>
206
+ <label for="community" onclick="">Community</label>
207
+ <input id="verified" name="filter" type="radio" checked="checked"/>
208
+ <label for="verified" onclick="">Verified</label>
209
+ <!-- <input id="minimal" name="compactness" type="radio"/>-->
210
+ <!-- <label for="minimal" onclick="">Minimal</label>-->
211
+ </div>
212
+
213
+
214
+
215
+ </div>
216
+ <!-- Baseline小灰字-->
217
+ <div class="container" style="text-align: center; margin-bottom: 10px; margin-top: -10px;">
218
+ <small id="alpaca_eval_info" style="color: #777;">
219
+ Baseline: GPT-4 Preview (11/06) &nbsp; | &nbsp; Auto-annotator: GPT-4 Preview (11/06)
220
+ </small>
221
+ </div>
222
+
223
+
224
+ <!-- 排行榜本体-->
225
+ <table id="leaderboard">
226
+ <tr>
227
+ <th class="rank">Rank</th>
228
+ <th class="name" onclick="sortTable('algorithm')">Algorithm <span id="arrow-algorithm">↕</span></th>
229
+ <th class="lenWinRate" onclick="sortTable('num_features')">#Features <span id="arrow-num_features">↕</span></th>
230
+ <th class="winRate" onclick="sortTable('mean_f1')">Mean F1 <span id="arrow-mean_f1">↕</span></th>
231
+ <th class="winRate" onclick="sortTable('mean_auc')">Mean AUC <span id="arrow-mean_auc">↕</span></th>
232
+ <th class="winRate" onclick="sortTable('time')">Time (s) <span id="arrow-time">↕</span></th>
233
+ </tr>
234
+ </table>
235
+
236
+ <!-- 文档简介-->
237
+ <div id="documentation">
238
+ <div style="text-align: center;">
239
+ <a href="https://github.com/tatsu-lab/alpaca_eval" style="display: inline-block;">
240
+ <i class="fab fa-fw fa-github" aria-hidden="true"></i> Github
241
+ </a>
242
+ </div>
243
+ <br>
244
+ <h2>About AlpacaEval</h2>
245
+ <p>
246
+ <a href="https://github.com/tatsu-lab/alpaca_eval" target="_blank">AlpacaEval</a>
247
+ an LLM-based automatic evaluation that is fast, cheap, and reliable.
248
+ It is based on the
249
+ <a href="https://crfm.stanford.edu/2023/05/22/alpaca-farm.html">AlpacaFarm</a>
250
+ evaluation set,
251
+ which tests the ability of models to follow general user instructions.
252
+ These responses are then compared to reference responses (Davinci003 for AlpacaEval, GPT-4 Preview for AlpacaEval 2.0) by
253
+ the provided GPT-4 based auto-annotators,
254
+ which results in the win rates presented above.
255
+ AlpacaEval displays a high agreement rate with ground truth human annotations,
256
+ and leaderboard rankings on AlpacaEval are very correlated with leaderboard rankings
257
+ based on human annotators.
258
+ Please see our
259
+ <a href="https://github.com/tatsu-lab/alpaca_eval#analysis" target="_blank">documentation</a>
260
+ for more details on our analysis.
261
+ </p>
262
+ <h2>Adding new models</h2>
263
+ <p>
264
+ We welcome new model contributions to the leaderboard from the community!
265
+ To do so, please follow the steps in the
266
+ <a href="https://github.com/tatsu-lab/alpaca_eval#contributing" target="_blank">contributions
267
+ section</a>.
268
+ Specifically, you'll need to run the model on the evaluation set,
269
+ auto-annotate the outputs, and submit a PR with the model config and leaderboard results.
270
+ We've also set up a
271
+ <a href="https://discord.gg/GJMxJSVZZM" target="_blank">Discord</a>
272
+ for community support and discussion.
273
+ </p>
274
+ <h2>Adding new evaluators or eval sets </h2>
275
+ <p>
276
+ We also welcome contributions for new evaluators or new eval sets!
277
+ For making new evaluators, we release our ground-truth
278
+ <a href="https://github.com/tatsu-lab/alpaca_eval#data-release" target="_blank">human annotations</a>
279
+ and <a href="https://github.com/tatsu-lab/alpaca_eval#analyzing-an-evaluator" target="_blank">comparison
280
+ metrics</a>.
281
+ We also release a
282
+ <a href="https://github.com/tatsu-lab/alpaca_eval#analyzing-an-eval-set" target="_blank">rough guide</a>
283
+ to follow for making new eval sets.
284
+ We specifically encourage contributions for harder instructions distributions and for safety testing of
285
+ LLMs.
286
+ </p>
287
+ <h2>AlpacaEval limitations</h2>
288
+ <p>
289
+ 这里是简介
290
+ </p>
291
+ </div>
292
+
293
+ </div>
294
+
295
+ <script>
296
+ const alpacaEvalRadio = document.getElementById('alpaca_eval');
297
+ const alpacaEval2Radio = document.getElementById('alpaca_eval_2');
298
+
299
+ const communityRadio = document.getElementById('community');
300
+ const verifiedRadio = document.getElementById('verified');
301
+ // const minimalRadio = document.getElementById('minimal');
302
+
303
+ const table = document.getElementById('leaderboard');
304
+
305
+ const urls = {
306
+ 'alpaca_eval': 'https://raw.githubusercontent.com/tatsu-lab/alpaca_eval/main/docs/data_AlpacaEval/alpaca_eval_gpt4_leaderboard.csv',
307
+ 'alpaca_eval_2': 'https://raw.githubusercontent.com/tatsu-lab/alpaca_eval/main/docs/data_AlpacaEval_2/weighted_alpaca_eval_gpt4_turbo_leaderboard.csv',
308
+ // 'claude': 'https://raw.githubusercontent.com/tatsu-lab/alpaca_eval/main/docs/claude_leaderboard.csv',
309
+ }
310
+
311
+ let currentUrl = urls['alpaca_eval_2'];
312
+
313
+ function updateTable(url) {
314
+ while (table.rows.length > 1) {
315
+ table.deleteRow(1);
316
+ }
317
+
318
+ Papa.parse(url, {
319
+ download: true,
320
+ header: true,
321
+ complete: function (results) {
322
+ console.log(results.data);
323
+ let rank = 0; // Initialize rank counter
324
+ results.data.forEach(row => {
325
+ if (row['name'] || row['win_rate'] || row['length_controlled_winrate']) { //|| row['avg_length']
326
+ let filter = row['filter'];
327
+
328
+ if ((communityRadio.checked && (filter === 'verified' || filter === 'minimal' || filter === 'community')) ||
329
+ (verifiedRadio.checked && (filter === 'verified' || filter === 'minimal'))) {
330
+
331
+ const tr = document.createElement('tr');
332
+ const rankTd = document.createElement('td');
333
+ const nameTd = document.createElement('td');
334
+ const winRateTd = document.createElement('td');
335
+ //const lengthTd = document.createElement('td');
336
+ const lenWinRateTd = document.createElement('td');
337
+
338
+ rankTd.classList.add('rank');
339
+ nameTd.classList.add('name');
340
+ winRateTd.classList.add('winRate');
341
+ lenWinRateTd.classList.add('lenWinRate');
342
+
343
+ // Set the rank value
344
+ rank++;
345
+ rankTd.textContent = rank;
346
+
347
+ if (row['link'] && row['link'].trim() !== '') {
348
+ const a = document.createElement('a');
349
+ a.textContent = row['name'];
350
+ a.href = row['link'];
351
+ a.target = "_blank";
352
+ nameTd.appendChild(a);
353
+ } else {
354
+ nameTd.textContent = row['name'];
355
+ }
356
+
357
+
358
+ if (row['samples'] && row['samples'].trim() !== '') {
359
+ const samplesLink = document.createElement('a');
360
+ samplesLink.textContent = " 📄"; // adding a space before emoji to separate from name
361
+ samplesLink.href = row['samples'];
362
+ samplesLink.target = "_blank";
363
+ samplesLink.style.textDecoration = "none";
364
+ nameTd.appendChild(samplesLink);
365
+ }
366
+
367
+ winRateTd.textContent = Number(row['win_rate']).toFixed(1) + '%';
368
+
369
+ if (row['length_controlled_winrate'] === '') {
370
+ lenWinRateTd.textContent = 'N/A';
371
+ } else {
372
+ lenWinRateTd.textContent = Number(row['length_controlled_winrate']).toFixed(1) + '%';
373
+ }
374
+ //lenWinRateTd.textContent = Number(row['length_controlled_winrate']).toFixed(1) + '%';
375
+ //lengthTd.textContent = Math.round(Number(row['avg_length'])).toString() ;
376
+
377
+
378
+ tr.appendChild(rankTd);
379
+ tr.appendChild(nameTd);
380
+ tr.appendChild(lenWinRateTd);
381
+ tr.appendChild(winRateTd);
382
+ //tr.appendChild(lengthTd);
383
+
384
+ table.appendChild(tr);
385
+ }
386
+ }
387
+ });
388
+ }
389
+ });
390
+ }
391
+
392
+ function updateInfoMessage(version) {
393
+ let infoText;
394
+ if (version === 'alpaca_eval_2') {
395
+ infoText = 'Baseline: GPT-4 Preview (11/06) &nbsp; | &nbsp; Auto-annotator: GPT-4 Preview (11/06)';
396
+ } else if (version === 'alpaca_eval') {
397
+ infoText = 'Baseline: Davinci003 &nbsp; | &nbsp; Auto-annotator: GPT-4';
398
+ }
399
+ document.getElementById('alpaca_eval_info').innerHTML = infoText;
400
+ }
401
+
402
+ updateTable(urls['alpaca_eval_2']);
403
+
404
+ alpacaEval2Radio.addEventListener('click', function () {
405
+ currentUrl = urls['alpaca_eval_2'];
406
+ updateTable(currentUrl);
407
+ updateInfoMessage('alpaca_eval_2');
408
+ });
409
+
410
+ alpacaEvalRadio.addEventListener('click', function () {
411
+ currentUrl = urls['alpaca_eval'];
412
+ updateTable(currentUrl);
413
+ updateInfoMessage('alpaca_eval');
414
+ });
415
+
416
+ communityRadio.addEventListener('click', function () {
417
+ updateTable(currentUrl);
418
+ });
419
+
420
+ verifiedRadio.addEventListener('click', function () {
421
+ updateTable(currentUrl);
422
+ });
423
+
424
+ // minimalRadio.addEventListener('click', function () {
425
+ // updateTable(currentUrl);
426
+ // });
427
+
428
+ updateCautionMessage('alpaca_eval_2');
429
+ </script>
430
+
431
+
432
+ </body>
433
+
434
+ </html>
AutoFS/__pycache__/leaderboard.cpython-37.pyc ADDED
Binary file (1.41 kB). View file
 
AutoFS/debug_data.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ import sys
4
+ import traceback
5
+
6
+ # Mock paths
7
+ PROJECT_ROOT = os.path.abspath(os.getcwd())
8
+ RESULT_DIR = os.path.join(PROJECT_ROOT, "results")
9
+ print(f"Result Dir: {RESULT_DIR}")
10
+
11
+ dataset = "Authorship"
12
+ path = os.path.join(RESULT_DIR, f"{dataset}.json")
13
+ print(f"Path: {path}")
14
+ print(f"Exists: {os.path.exists(path)}")
15
+
16
+ if os.path.exists(path):
17
+ try:
18
+ with open(path, 'r', encoding='utf-8') as f:
19
+ data = json.load(f)
20
+ print(f"Data loaded, length: {len(data)}")
21
+
22
+ # Try ranking
23
+ sys.path.append(PROJECT_ROOT)
24
+ try:
25
+ from leaderboard import rank_results
26
+ ranked = rank_results(data)
27
+ print(f"Ranked data length: {len(ranked)}")
28
+ if len(ranked) > 0:
29
+ print("First item:", ranked[0])
30
+ except Exception as e:
31
+ print(f"Ranking failed: {e}")
32
+ traceback.print_exc()
33
+ except Exception as e:
34
+ print(f"Failed to read/parse json: {e}")
35
+ else:
36
+ print("File not found!")
AutoFS/leaderboard.py ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pandas as pd
3
+ # def rank_results(
4
+ # results,
5
+ # metric="f1",
6
+ # clf_average="mean",
7
+ # weights=None
8
+ # ):
9
+ # """
10
+ # 对 FSExecutor 输出结果进行排行榜排序
11
+
12
+ # Parameters
13
+ # ----------
14
+ # results : list of dict
15
+ # 每个 dict 是一个算法在一个数据集上的结果
16
+ # metric : str
17
+ # 使用的指标: 'f1' or 'auc'
18
+ # clf_average : str
19
+ # 'mean' 或 'max',表示跨分类器如何聚合
20
+ # weights : dict or None
21
+ # 多指标加权,例如 {'f1':0.5, 'auc':0.5}
22
+
23
+ # Returns
24
+ # -------
25
+ # ranked_df : pd.DataFrame
26
+ # """
27
+
28
+ # rows = []
29
+
30
+ # for res in results:
31
+ # algo = res["algorithm"]
32
+ # metrics = res["metrics"]
33
+
34
+ # # --------- 单指标 ----------
35
+ # if weights is None:
36
+ # vals = []
37
+ # for clf, m in metrics.items():
38
+ # if metric in m:
39
+ # vals.append(m[metric])
40
+
41
+ # if not vals:
42
+ # raise ValueError(f"No metric {metric} for {algo}")
43
+
44
+ # score = np.mean(vals) if clf_average == "mean" else np.max(vals)
45
+
46
+ # # --------- 多指标加权 ----------
47
+ # else:
48
+ # score = 0.0
49
+ # for m_name, w in weights.items():
50
+ # vals = [
51
+ # metrics[clf][m_name]
52
+ # for clf in metrics
53
+ # if m_name in metrics[clf]
54
+ # ]
55
+ # score += w * np.mean(vals)
56
+
57
+ # rows.append({
58
+ # "algorithm": algo,
59
+ # "score": score,
60
+ # "num_features": res["num_features"],
61
+ # "time": res.get("time", None)
62
+ # })
63
+
64
+ # df = pd.DataFrame(rows)
65
+
66
+ # # --------- 按 score 排序 ----------
67
+ # df = df.sort_values(
68
+ # by="score",
69
+ # ascending=False
70
+ # ).reset_index(drop=True)
71
+
72
+ # df["rank"] = df.index + 1
73
+
74
+ # return df
75
+
76
+ def aggregate_metrics(metrics, w_f1=0.7, w_auc=0.3):
77
+ """
78
+ metrics:
79
+ {
80
+ "nb": {"f1": x, "auc": y},
81
+ "svm": {"f1": x, "auc": y},
82
+ "rf": {"f1": x, "auc": y},
83
+ }
84
+ """
85
+ f1s = [m["f1"] for m in metrics.values()]
86
+ aucs = [m["auc"] for m in metrics.values()]
87
+
88
+ mean_f1 = sum(f1s) / len(f1s)
89
+ mean_auc = sum(aucs) / len(aucs)
90
+
91
+ return w_f1 * mean_f1 + w_auc * mean_auc,mean_f1,mean_auc
92
+
93
+ def rank_results(
94
+ results,
95
+ ):
96
+ """
97
+ results: list[dict]
98
+ return: 排序后的 list[dict](每个 dict 会新增 score 字段)
99
+ """
100
+
101
+ ranked = []
102
+
103
+ for r in results:
104
+ # 1. 性能融合
105
+ perf_score,mean_f1,mean_auc = aggregate_metrics(r["metrics"])
106
+
107
+ # 2. 惩罚项
108
+ # feature_penalty = alpha * r["num_features"]
109
+ # time_penalty = beta * r["time"]
110
+
111
+ # final_score = perf_score - feature_penalty - time_penalty
112
+ final_score = perf_score
113
+ ranked.append({
114
+ **r,
115
+ "mean_f1":mean_f1,
116
+ "mean_auc":mean_auc,
117
+ "score": final_score,
118
+ "perf_score": perf_score
119
+ })
120
+
121
+ # 3. 排序(score 越大越好)
122
+ ranked.sort(key=lambda x: x["score"], reverse=True)
123
+
124
+ return ranked
AutoFS/requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ Flask
2
+ pandas
3
+ numpy
AutoFS/results/Authorship.json ADDED
@@ -0,0 +1,349 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "selected_features": [
4
+ 59,
5
+ 50,
6
+ 56,
7
+ 4,
8
+ 38,
9
+ 9,
10
+ 29,
11
+ 23,
12
+ 0,
13
+ 20,
14
+ 34,
15
+ 36,
16
+ 24,
17
+ 26,
18
+ 28
19
+ ],
20
+ "num_features": 15,
21
+ "metrics": {
22
+ "nb": {
23
+ "f1": 0.9181133571145461,
24
+ "auc": 0.9807805770573524
25
+ },
26
+ "svm": {
27
+ "f1": 0.9282600079270711,
28
+ "auc": 0.980695564275392
29
+ },
30
+ "rf": {
31
+ "f1": 0.9219976218787156,
32
+ "auc": 0.9768411621948705
33
+ }
34
+ },
35
+ "time": 7.003696441650391,
36
+ "algorithm": "JMIM"
37
+ },
38
+ {
39
+ "selected_features": [
40
+ 59,
41
+ 50,
42
+ 56,
43
+ 4,
44
+ 38,
45
+ 0,
46
+ 9,
47
+ 29,
48
+ 23,
49
+ 20,
50
+ 36,
51
+ 34,
52
+ 24,
53
+ 28,
54
+ 26
55
+ ],
56
+ "num_features": 15,
57
+ "metrics": {
58
+ "nb": {
59
+ "f1": 0.9163694015061433,
60
+ "auc": 0.9805189493459717
61
+ },
62
+ "svm": {
63
+ "f1": 0.9265953230281413,
64
+ "auc": 0.98064247666047
65
+ },
66
+ "rf": {
67
+ "f1": 0.9189853349187476,
68
+ "auc": 0.97694404479886
69
+ }
70
+ },
71
+ "time": 2.083444595336914,
72
+ "algorithm": "CFR"
73
+ },
74
+ {
75
+ "selected_features": [
76
+ 59,
77
+ 64,
78
+ 63,
79
+ 22,
80
+ 26,
81
+ 11,
82
+ 49,
83
+ 7,
84
+ 18,
85
+ 24,
86
+ 28,
87
+ 12,
88
+ 0,
89
+ 8,
90
+ 45
91
+ ],
92
+ "num_features": 15,
93
+ "metrics": {
94
+ "nb": {
95
+ "f1": 0.8498612762584224,
96
+ "auc": 0.9612941645198875
97
+ },
98
+ "svm": {
99
+ "f1": 0.8672215616329766,
100
+ "auc": 0.9669919810144432
101
+ },
102
+ "rf": {
103
+ "f1": 0.8516052318668254,
104
+ "auc": 0.9579321358773162
105
+ }
106
+ },
107
+ "time": 3.310762882232666,
108
+ "algorithm": "DCSF"
109
+ },
110
+ {
111
+ "selected_features": [
112
+ 69,
113
+ 59,
114
+ 9,
115
+ 4,
116
+ 38,
117
+ 24,
118
+ 0,
119
+ 49,
120
+ 26,
121
+ 18,
122
+ 28,
123
+ 11,
124
+ 66,
125
+ 12,
126
+ 7
127
+ ],
128
+ "num_features": 15,
129
+ "metrics": {
130
+ "nb": {
131
+ "f1": 0.8747522790328972,
132
+ "auc": 0.968331958034509
133
+ },
134
+ "svm": {
135
+ "f1": 0.8916369401506141,
136
+ "auc": 0.9765525653706246
137
+ },
138
+ "rf": {
139
+ "f1": 0.9151010701545778,
140
+ "auc": 0.9804839794856123
141
+ }
142
+ },
143
+ "time": 2.473106622695923,
144
+ "algorithm": "IWFS"
145
+ },
146
+ {
147
+ "selected_features": [
148
+ 59,
149
+ 50,
150
+ 4,
151
+ 38,
152
+ 24,
153
+ 0,
154
+ 56,
155
+ 26,
156
+ 29,
157
+ 49,
158
+ 28,
159
+ 23,
160
+ 34,
161
+ 36,
162
+ 20
163
+ ],
164
+ "num_features": 15,
165
+ "metrics": {
166
+ "nb": {
167
+ "f1": 0.8806183115338884,
168
+ "auc": 0.973024320439098
169
+ },
170
+ "svm": {
171
+ "f1": 0.9082837891399126,
172
+ "auc": 0.9784503098286724
173
+ },
174
+ "rf": {
175
+ "f1": 0.897661514070551,
176
+ "auc": 0.973555585899326
177
+ }
178
+ },
179
+ "time": 2.8017048835754395,
180
+ "algorithm": "MRI"
181
+ },
182
+ {
183
+ "selected_features": [
184
+ 59,
185
+ 69,
186
+ 9,
187
+ 5,
188
+ 10,
189
+ 31,
190
+ 36,
191
+ 20,
192
+ 33,
193
+ 47,
194
+ 22,
195
+ 29,
196
+ 44,
197
+ 56,
198
+ 8
199
+ ],
200
+ "num_features": 15,
201
+ "metrics": {
202
+ "nb": {
203
+ "f1": 0.911375346809354,
204
+ "auc": 0.979648928949016
205
+ },
206
+ "svm": {
207
+ "f1": 0.9064605628220372,
208
+ "auc": 0.9782951525850493
209
+ },
210
+ "rf": {
211
+ "f1": 0.9252477209671027,
212
+ "auc": 0.9822235518665571
213
+ }
214
+ },
215
+ "time": 1.9699223041534424,
216
+ "algorithm": "MRMD"
217
+ },
218
+ {
219
+ "selected_features": [
220
+ 59,
221
+ 69,
222
+ 9,
223
+ 56,
224
+ 29,
225
+ 50,
226
+ 36,
227
+ 4,
228
+ 38,
229
+ 0,
230
+ 20,
231
+ 24,
232
+ 23,
233
+ 28,
234
+ 34
235
+ ],
236
+ "num_features": 15,
237
+ "metrics": {
238
+ "nb": {
239
+ "f1": 0.9177962742766549,
240
+ "auc": 0.9819010381640604
241
+ },
242
+ "svm": {
243
+ "f1": 0.9178755449861277,
244
+ "auc": 0.980385760789456
245
+ },
246
+ "rf": {
247
+ "f1": 0.9344431232659534,
248
+ "auc": 0.9825426064346192
249
+ }
250
+ },
251
+ "time": 4.2307515144348145,
252
+ "algorithm": "UCRFS"
253
+ },
254
+ {
255
+ "selected_features": [
256
+ [
257
+ 23,
258
+ 15,
259
+ 69,
260
+ 43,
261
+ 9,
262
+ 52,
263
+ 33,
264
+ 8,
265
+ 5,
266
+ 3,
267
+ 59,
268
+ 47,
269
+ 34,
270
+ 55,
271
+ 36
272
+ ],
273
+ [
274
+ 50,
275
+ 16,
276
+ 31,
277
+ 44,
278
+ 47,
279
+ 9,
280
+ 69,
281
+ 42,
282
+ 33,
283
+ 36,
284
+ 63,
285
+ 65,
286
+ 23,
287
+ 20,
288
+ 22
289
+ ],
290
+ [
291
+ 29,
292
+ 13,
293
+ 38,
294
+ 3,
295
+ 28,
296
+ 59,
297
+ 56,
298
+ 69,
299
+ 26,
300
+ 20,
301
+ 34,
302
+ 50,
303
+ 14,
304
+ 49,
305
+ 36
306
+ ],
307
+ [
308
+ 59,
309
+ 19,
310
+ 20,
311
+ 36,
312
+ 24,
313
+ 29,
314
+ 9,
315
+ 10,
316
+ 23,
317
+ 28,
318
+ 22,
319
+ 8,
320
+ 56,
321
+ 0,
322
+ 60
323
+ ]
324
+ ],
325
+ "num_features": [
326
+ 15,
327
+ 15,
328
+ 15,
329
+ 15
330
+ ],
331
+ "union_num_features": 4,
332
+ "metrics": {
333
+ "nb": {
334
+ "f1": 0.879587792310741,
335
+ "auc": 0.9680606961937624
336
+ },
337
+ "svm": {
338
+ "f1": 0.8917162108600871,
339
+ "auc": 0.9710497573464302
340
+ },
341
+ "rf": {
342
+ "f1": 0.8789536266349584,
343
+ "auc": 0.9655310038725752
344
+ }
345
+ },
346
+ "time": 12.251755952835083,
347
+ "algorithm": "CSMDCCMR"
348
+ }
349
+ ]
AutoFS/results/Factors.json ADDED
@@ -0,0 +1,457 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "selected_features": [
4
+ 180,
5
+ 63,
6
+ 110,
7
+ 194,
8
+ 193,
9
+ 184,
10
+ 197,
11
+ 25,
12
+ 147,
13
+ 36,
14
+ 96,
15
+ 170,
16
+ 181,
17
+ 0,
18
+ 37
19
+ ],
20
+ "num_features": 15,
21
+ "metrics": {
22
+ "nb": {
23
+ "f1": 0.7585666666666667,
24
+ "auc": 0.964653722222222
25
+ },
26
+ "svm": {
27
+ "f1": 0.7981999999999999,
28
+ "auc": 0.9716779444444446
29
+ },
30
+ "rf": {
31
+ "f1": 0.7977666666666666,
32
+ "auc": 0.963972537037037
33
+ }
34
+ },
35
+ "time": 66.49715518951416,
36
+ "algorithm": "JMIM"
37
+ },
38
+ {
39
+ "selected_features": [
40
+ 180,
41
+ 63,
42
+ 110,
43
+ 193,
44
+ 194,
45
+ 65,
46
+ 147,
47
+ 25,
48
+ 64,
49
+ 38,
50
+ 37,
51
+ 96,
52
+ 36,
53
+ 39,
54
+ 182
55
+ ],
56
+ "num_features": 15,
57
+ "metrics": {
58
+ "nb": {
59
+ "f1": 0.7479,
60
+ "auc": 0.9626535185185184
61
+ },
62
+ "svm": {
63
+ "f1": 0.7959666666666666,
64
+ "auc": 0.9715684444444446
65
+ },
66
+ "rf": {
67
+ "f1": 0.7907666666666667,
68
+ "auc": 0.9631266018518517
69
+ }
70
+ },
71
+ "time": 16.008829355239868,
72
+ "algorithm": "CFR"
73
+ },
74
+ {
75
+ "selected_features": [
76
+ 180,
77
+ 213,
78
+ 130,
79
+ 79,
80
+ 174,
81
+ 188,
82
+ 179,
83
+ 16,
84
+ 67,
85
+ 116,
86
+ 210,
87
+ 190,
88
+ 55,
89
+ 141,
90
+ 4
91
+ ],
92
+ "num_features": 15,
93
+ "metrics": {
94
+ "nb": {
95
+ "f1": 0.7210333333333333,
96
+ "auc": 0.9526347777777778
97
+ },
98
+ "svm": {
99
+ "f1": 0.5048333333333334,
100
+ "auc": 0.8947246296296296
101
+ },
102
+ "rf": {
103
+ "f1": 0.7523333333333333,
104
+ "auc": 0.9497905462962962
105
+ }
106
+ },
107
+ "time": 22.65188217163086,
108
+ "algorithm": "DCSF"
109
+ },
110
+ {
111
+ "selected_features": [
112
+ 180,
113
+ 119,
114
+ 63,
115
+ 67,
116
+ 188,
117
+ 16,
118
+ 162,
119
+ 79,
120
+ 196,
121
+ 24,
122
+ 115,
123
+ 174,
124
+ 120,
125
+ 106,
126
+ 175
127
+ ],
128
+ "num_features": 15,
129
+ "metrics": {
130
+ "nb": {
131
+ "f1": 0.7468333333333333,
132
+ "auc": 0.9592038333333333
133
+ },
134
+ "svm": {
135
+ "f1": 0.5647,
136
+ "auc": 0.9142652037037037
137
+ },
138
+ "rf": {
139
+ "f1": 0.7945666666666668,
140
+ "auc": 0.962168101851852
141
+ }
142
+ },
143
+ "time": 16.929046392440796,
144
+ "algorithm": "IWFS"
145
+ },
146
+ {
147
+ "selected_features": [
148
+ 180,
149
+ 63,
150
+ 16,
151
+ 19,
152
+ 24,
153
+ 120,
154
+ 4,
155
+ 72,
156
+ 188,
157
+ 60,
158
+ 121,
159
+ 27,
160
+ 26,
161
+ 162,
162
+ 196
163
+ ],
164
+ "num_features": 15,
165
+ "metrics": {
166
+ "nb": {
167
+ "f1": 0.6856333333333334,
168
+ "auc": 0.9451895555555555
169
+ },
170
+ "svm": {
171
+ "f1": 0.6991666666666667,
172
+ "auc": 0.948404962962963
173
+ },
174
+ "rf": {
175
+ "f1": 0.7519333333333333,
176
+ "auc": 0.9530803055555556
177
+ }
178
+ },
179
+ "time": 20.568500757217407,
180
+ "algorithm": "MRI"
181
+ },
182
+ {
183
+ "selected_features": [
184
+ 180,
185
+ 11,
186
+ 189,
187
+ 54,
188
+ 32,
189
+ 211,
190
+ 118,
191
+ 71,
192
+ 93,
193
+ 18,
194
+ 0,
195
+ 139,
196
+ 107,
197
+ 164,
198
+ 102
199
+ ],
200
+ "num_features": 15,
201
+ "metrics": {
202
+ "nb": {
203
+ "f1": 0.7785666666666669,
204
+ "auc": 0.9682892037037037
205
+ },
206
+ "svm": {
207
+ "f1": 0.6084999999999999,
208
+ "auc": 0.931185111111111
209
+ },
210
+ "rf": {
211
+ "f1": 0.8092,
212
+ "auc": 0.9640595
213
+ }
214
+ },
215
+ "time": 14.148123025894165,
216
+ "algorithm": "MRMD"
217
+ },
218
+ {
219
+ "selected_features": [
220
+ 180,
221
+ 11,
222
+ 189,
223
+ 54,
224
+ 32,
225
+ 96,
226
+ 64,
227
+ 36,
228
+ 98,
229
+ 63,
230
+ 29,
231
+ 0,
232
+ 156,
233
+ 14,
234
+ 207
235
+ ],
236
+ "num_features": 15,
237
+ "metrics": {
238
+ "nb": {
239
+ "f1": 0.7952333333333332,
240
+ "auc": 0.9707861666666667
241
+ },
242
+ "svm": {
243
+ "f1": 0.6813666666666668,
244
+ "auc": 0.9460895925925925
245
+ },
246
+ "rf": {
247
+ "f1": 0.8157333333333334,
248
+ "auc": 0.9653315277777779
249
+ }
250
+ },
251
+ "time": 29.169645071029663,
252
+ "algorithm": "UCRFS"
253
+ },
254
+ {
255
+ "selected_features": [
256
+ [
257
+ 211,
258
+ 177,
259
+ 198,
260
+ 92,
261
+ 178,
262
+ 215,
263
+ 7,
264
+ 111,
265
+ 118,
266
+ 93,
267
+ 139,
268
+ 107,
269
+ 4,
270
+ 67,
271
+ 102
272
+ ],
273
+ [
274
+ 85,
275
+ 214,
276
+ 151,
277
+ 131,
278
+ 104,
279
+ 90,
280
+ 141,
281
+ 111,
282
+ 102,
283
+ 139,
284
+ 178,
285
+ 128,
286
+ 47,
287
+ 199,
288
+ 42
289
+ ],
290
+ [
291
+ 36,
292
+ 59,
293
+ 46,
294
+ 33,
295
+ 212,
296
+ 179,
297
+ 54,
298
+ 144,
299
+ 127,
300
+ 140,
301
+ 30,
302
+ 71,
303
+ 116,
304
+ 199,
305
+ 132
306
+ ],
307
+ [
308
+ 110,
309
+ 214,
310
+ 189,
311
+ 163,
312
+ 90,
313
+ 176,
314
+ 191,
315
+ 65,
316
+ 151,
317
+ 102,
318
+ 208,
319
+ 116,
320
+ 30,
321
+ 69,
322
+ 58
323
+ ],
324
+ [
325
+ 185,
326
+ 177,
327
+ 200,
328
+ 139,
329
+ 95,
330
+ 30,
331
+ 178,
332
+ 153,
333
+ 120,
334
+ 212,
335
+ 72,
336
+ 42,
337
+ 107,
338
+ 19,
339
+ 105
340
+ ],
341
+ [
342
+ 86,
343
+ 214,
344
+ 119,
345
+ 6,
346
+ 92,
347
+ 100,
348
+ 93,
349
+ 31,
350
+ 102,
351
+ 4,
352
+ 54,
353
+ 68,
354
+ 187,
355
+ 208,
356
+ 35
357
+ ],
358
+ [
359
+ 108,
360
+ 213,
361
+ 32,
362
+ 179,
363
+ 139,
364
+ 54,
365
+ 105,
366
+ 204,
367
+ 10,
368
+ 116,
369
+ 23,
370
+ 26,
371
+ 201,
372
+ 188,
373
+ 113
374
+ ],
375
+ [
376
+ 5,
377
+ 59,
378
+ 70,
379
+ 176,
380
+ 66,
381
+ 45,
382
+ 7,
383
+ 196,
384
+ 93,
385
+ 118,
386
+ 98,
387
+ 131,
388
+ 152,
389
+ 67,
390
+ 84
391
+ ],
392
+ [
393
+ 0,
394
+ 214,
395
+ 35,
396
+ 199,
397
+ 111,
398
+ 105,
399
+ 66,
400
+ 4,
401
+ 116,
402
+ 79,
403
+ 107,
404
+ 29,
405
+ 34,
406
+ 48,
407
+ 9
408
+ ],
409
+ [
410
+ 96,
411
+ 59,
412
+ 33,
413
+ 198,
414
+ 80,
415
+ 199,
416
+ 100,
417
+ 102,
418
+ 34,
419
+ 132,
420
+ 119,
421
+ 8,
422
+ 111,
423
+ 93,
424
+ 174
425
+ ]
426
+ ],
427
+ "num_features": [
428
+ 15,
429
+ 15,
430
+ 15,
431
+ 15,
432
+ 15,
433
+ 15,
434
+ 15,
435
+ 15,
436
+ 15,
437
+ 15
438
+ ],
439
+ "union_num_features": 10,
440
+ "metrics": {
441
+ "nb": {
442
+ "f1": 0.7188666666666665,
443
+ "auc": 0.9467155555555556
444
+ },
445
+ "svm": {
446
+ "f1": 0.5817666666666667,
447
+ "auc": 0.9037647222222223
448
+ },
449
+ "rf": {
450
+ "f1": 0.7609666666666667,
451
+ "auc": 0.9450812870370371
452
+ }
453
+ },
454
+ "time": 192.19890308380127,
455
+ "algorithm": "CSMDCCMR"
456
+ }
457
+ ]
AutoFS/results/dna.json ADDED
@@ -0,0 +1,331 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "selected_features": [
4
+ 89,
5
+ 92,
6
+ 84,
7
+ 104,
8
+ 82,
9
+ 99,
10
+ 88,
11
+ 87,
12
+ 90,
13
+ 91,
14
+ 85,
15
+ 95,
16
+ 83,
17
+ 93,
18
+ 81
19
+ ],
20
+ "num_features": 15,
21
+ "metrics": {
22
+ "nb": {
23
+ "f1": 0.7640929064657878,
24
+ "auc": 0.9133179854605366
25
+ },
26
+ "svm": {
27
+ "f1": 0.8536304666248171,
28
+ "auc": 0.9352907039838904
29
+ },
30
+ "rf": {
31
+ "f1": 0.8522494245658089,
32
+ "auc": 0.9412461781596505
33
+ }
34
+ },
35
+ "time": 61.692588090896606,
36
+ "algorithm": "JMIM"
37
+ },
38
+ {
39
+ "selected_features": [
40
+ 89,
41
+ 92,
42
+ 84,
43
+ 104,
44
+ 82,
45
+ 99,
46
+ 93,
47
+ 88,
48
+ 87,
49
+ 90,
50
+ 95,
51
+ 94,
52
+ 85,
53
+ 83,
54
+ 86
55
+ ],
56
+ "num_features": 15,
57
+ "metrics": {
58
+ "nb": {
59
+ "f1": 0.8071772337309061,
60
+ "auc": 0.9251172965675879
61
+ },
62
+ "svm": {
63
+ "f1": 0.8628164888051894,
64
+ "auc": 0.9403608959817996
65
+ },
66
+ "rf": {
67
+ "f1": 0.86185394433982,
68
+ "auc": 0.9447127585949784
69
+ }
70
+ },
71
+ "time": 14.362110137939453,
72
+ "algorithm": "CFR"
73
+ },
74
+ {
75
+ "selected_features": [
76
+ 89,
77
+ 104,
78
+ 92,
79
+ 84,
80
+ 81,
81
+ 99,
82
+ 93,
83
+ 83,
84
+ 95,
85
+ 94,
86
+ 82,
87
+ 97,
88
+ 90,
89
+ 87,
90
+ 88
91
+ ],
92
+ "num_features": 15,
93
+ "metrics": {
94
+ "nb": {
95
+ "f1": 0.8425402803933877,
96
+ "auc": 0.9345225210498646
97
+ },
98
+ "svm": {
99
+ "f1": 0.881586105879891,
100
+ "auc": 0.9410499099603411
101
+ },
102
+ "rf": {
103
+ "f1": 0.8811048336472066,
104
+ "auc": 0.9480086728315744
105
+ }
106
+ },
107
+ "time": 23.570918560028076,
108
+ "algorithm": "DCSF"
109
+ },
110
+ {
111
+ "selected_features": [
112
+ 89,
113
+ 92,
114
+ 84,
115
+ 104,
116
+ 99,
117
+ 93,
118
+ 95,
119
+ 94,
120
+ 83,
121
+ 81,
122
+ 97,
123
+ 74,
124
+ 72,
125
+ 71,
126
+ 62
127
+ ],
128
+ "num_features": 15,
129
+ "metrics": {
130
+ "nb": {
131
+ "f1": 0.8436283741368488,
132
+ "auc": 0.9371476543435738
133
+ },
134
+ "svm": {
135
+ "f1": 0.8793262188742416,
136
+ "auc": 0.9464104127302048
137
+ },
138
+ "rf": {
139
+ "f1": 0.8789077212806028,
140
+ "auc": 0.9477423771202302
141
+ }
142
+ },
143
+ "time": 17.612692832946777,
144
+ "algorithm": "IWFS"
145
+ },
146
+ {
147
+ "selected_features": [
148
+ 89,
149
+ 92,
150
+ 84,
151
+ 104,
152
+ 82,
153
+ 99,
154
+ 93,
155
+ 95,
156
+ 94,
157
+ 88,
158
+ 87,
159
+ 90,
160
+ 83,
161
+ 81,
162
+ 85
163
+ ],
164
+ "num_features": 15,
165
+ "metrics": {
166
+ "nb": {
167
+ "f1": 0.8277045406988911,
168
+ "auc": 0.9322267536115253
169
+ },
170
+ "svm": {
171
+ "f1": 0.8711027411592386,
172
+ "auc": 0.9431894900660284
173
+ },
174
+ "rf": {
175
+ "f1": 0.8701820464532329,
176
+ "auc": 0.9464250615396989
177
+ }
178
+ },
179
+ "time": 18.142696142196655,
180
+ "algorithm": "MRI"
181
+ },
182
+ {
183
+ "selected_features": [
184
+ 89,
185
+ 92,
186
+ 84,
187
+ 104,
188
+ 82,
189
+ 99,
190
+ 93,
191
+ 88,
192
+ 95,
193
+ 87,
194
+ 90,
195
+ 94,
196
+ 83,
197
+ 85,
198
+ 86
199
+ ],
200
+ "num_features": 15,
201
+ "metrics": {
202
+ "nb": {
203
+ "f1": 0.8157145846411384,
204
+ "auc": 0.9275568626302196
205
+ },
206
+ "svm": {
207
+ "f1": 0.8656204226825694,
208
+ "auc": 0.941107038573083
209
+ },
210
+ "rf": {
211
+ "f1": 0.8650554509311572,
212
+ "auc": 0.9451365316009367
213
+ }
214
+ },
215
+ "time": 14.290248394012451,
216
+ "algorithm": "MRMD"
217
+ },
218
+ {
219
+ "selected_features": [
220
+ 89,
221
+ 92,
222
+ 84,
223
+ 104,
224
+ 99,
225
+ 82,
226
+ 93,
227
+ 95,
228
+ 94,
229
+ 97,
230
+ 83,
231
+ 81,
232
+ 90,
233
+ 87,
234
+ 88
235
+ ],
236
+ "num_features": 15,
237
+ "metrics": {
238
+ "nb": {
239
+ "f1": 0.8353211969031178,
240
+ "auc": 0.9344102233712435
241
+ },
242
+ "svm": {
243
+ "f1": 0.8754760410127641,
244
+ "auc": 0.9449093560542415
245
+ },
246
+ "rf": {
247
+ "f1": 0.8743460975099393,
248
+ "auc": 0.9470115615925281
249
+ }
250
+ },
251
+ "time": 28.11224675178528,
252
+ "algorithm": "UCRFS"
253
+ },
254
+ {
255
+ "selected_features": [
256
+ [
257
+ 92,
258
+ 104,
259
+ 93,
260
+ 95,
261
+ 94,
262
+ 99,
263
+ 90,
264
+ 91,
265
+ 97,
266
+ 89,
267
+ 103,
268
+ 102,
269
+ 96,
270
+ 88,
271
+ 98
272
+ ],
273
+ [
274
+ 84,
275
+ 81,
276
+ 89,
277
+ 83,
278
+ 104,
279
+ 82,
280
+ 85,
281
+ 86,
282
+ 87,
283
+ 88,
284
+ 74,
285
+ 72,
286
+ 66,
287
+ 71,
288
+ 57
289
+ ],
290
+ [
291
+ 89,
292
+ 84,
293
+ 92,
294
+ 104,
295
+ 82,
296
+ 99,
297
+ 87,
298
+ 93,
299
+ 88,
300
+ 83,
301
+ 85,
302
+ 91,
303
+ 86,
304
+ 74,
305
+ 94
306
+ ]
307
+ ],
308
+ "num_features": [
309
+ 15,
310
+ 15,
311
+ 15
312
+ ],
313
+ "union_num_features": 3,
314
+ "metrics": {
315
+ "nb": {
316
+ "f1": 0.7881146683406571,
317
+ "auc": 0.9145317738835733
318
+ },
319
+ "svm": {
320
+ "f1": 0.8584641138313454,
321
+ "auc": 0.9310307930574658
322
+ },
323
+ "rf": {
324
+ "f1": 0.857187696170747,
325
+ "auc": 0.9399791620380172
326
+ }
327
+ },
328
+ "time": 96.02905464172363,
329
+ "algorithm": "CSMDCCMR"
330
+ }
331
+ ]
AutoFS/verify_backend.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import os
3
+ import sys
4
+
5
+ # Mock paths
6
+ PROJECT_ROOT = os.path.abspath(os.getcwd())
7
+ sys.path.append(PROJECT_ROOT)
8
+
9
+ from leaderboard import rank_results
10
+
11
+ def test_dataset(name):
12
+ path = os.path.join(PROJECT_ROOT, "results", f"{name}.json")
13
+ if not os.path.exists(path):
14
+ print(f"[ERROR] {name} not found")
15
+ return
16
+
17
+ with open(path, 'r', encoding='utf-8') as f:
18
+ data = json.load(f)
19
+
20
+ print(f"--- Testing {name} ---")
21
+ try:
22
+ ranked = rank_results(data)
23
+ if len(ranked) > 0:
24
+ first = ranked[0]
25
+ print("Keys in first item:", first.keys())
26
+ # Check for critical keys
27
+ for key in ['mean_f1', 'mean_auc', 'time']:
28
+ if key not in first:
29
+ print(f"[FAIL] Missing key: {key}")
30
+ elif first[key] is None:
31
+ print(f"[FAIL] Key is None: {key}")
32
+ else:
33
+ print(f"[OK] {key}: {first[key]} (type: {type(first[key])})")
34
+ else:
35
+ print("[WARN] Ranked list is empty")
36
+ except Exception as e:
37
+ print(f"[ERROR] Ranking failed: {e}")
38
+
39
+ test_dataset("Authorship")
40
+ test_dataset("Factors")
41
+ test_dataset("dna")