feat: default data not recorded
This commit is contained in:
+8
-6
@@ -4,6 +4,8 @@ import requests
|
||||
import time
|
||||
import traceback
|
||||
|
||||
EXP_URL = "http://10.2.1.195:880"
|
||||
|
||||
|
||||
def load_user_function(file_path, function_name):
|
||||
"""
|
||||
@@ -19,10 +21,10 @@ def evaluate_knn(
|
||||
user_func, train_data, train_labels, test_data, test_labels, log_details
|
||||
):
|
||||
"""
|
||||
使用学生编写的 KNN 函数对测试集进行分类,并计算准确率。
|
||||
使用编写的 KNN 函数对测试集进行分类,并计算准确率。
|
||||
|
||||
Args:
|
||||
- user_func (function): 学生编写的 KNN 函数。
|
||||
- user_func (function): 编写的 KNN 函数。
|
||||
- train_data (numpy array): 训练数据集。
|
||||
- train_labels (numpy array): 训练标签集。
|
||||
- test_data (numpy array): 测试数据集。
|
||||
@@ -82,7 +84,7 @@ def upload_score(name, id, score_data):
|
||||
"""
|
||||
上传成绩到服务器。
|
||||
"""
|
||||
url = "http://10.2.1.195:880/upload_score"
|
||||
url = f"{EXP_URL}/upload_score"
|
||||
try:
|
||||
print("上传成绩中...")
|
||||
# print(score_data)
|
||||
@@ -99,8 +101,8 @@ def upload_score(name, id, score_data):
|
||||
)
|
||||
if response.status_code == 200:
|
||||
print("上传成绩成功!")
|
||||
else:
|
||||
print("上传成绩失败:", response.json())
|
||||
elif response.status_code == 400:
|
||||
print("上传成绩失败!\n原因:", response.json()["message"])
|
||||
except Exception as e:
|
||||
print(f"上传成绩出错: {e}")
|
||||
|
||||
@@ -145,7 +147,7 @@ def main(name, id):
|
||||
score_data = {
|
||||
"score": accuracy,
|
||||
"running_time": f"{running_time * 1000:.10f}ms",
|
||||
"details": "\n".join(log_details), # 将日志记录加入 details 中
|
||||
"details": "\n".join(log_details),
|
||||
}
|
||||
|
||||
upload_score(name, id, score_data)
|
||||
|
||||
Reference in New Issue
Block a user