fix: test when total not match actually total

This commit is contained in:
2024-10-25 23:28:16 +08:00
parent fc59f4f1d8
commit deadf110aa
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ def evaluate_knn(
temp_log_details = [] temp_log_details = []
try: try:
for i in range(total): for i in range(len(test_data)):
# 获取测试数据中的每个样本 # 获取测试数据中的每个样本
result = user_func(test_data[i], train_data, train_labels) result = user_func(test_data[i], train_data, train_labels)
if result == test_labels[i]: if result == test_labels[i]:
+1 -1
View File
@@ -60,7 +60,7 @@ def evaluate_knn(
temp_log_details = [] temp_log_details = []
try: try:
for i in range(total): for i in range(len(test_data)):
# 获取测试数据中的每个样本 # 获取测试数据中的每个样本
result = user_func(test_data[i], train_data, train_labels) result = user_func(test_data[i], train_data, train_labels)
if result == test_labels[i]: if result == test_labels[i]:
+1 -1
View File
@@ -74,7 +74,7 @@ def evaluate_logreg(
log_details.append(f"训练时间: {(time_end - time_start)*1000:.10f}ms") log_details.append(f"训练时间: {(time_end - time_start)*1000:.10f}ms")
print(f"训练时间: {(time_end - time_start)*1000:.10f}ms") print(f"训练时间: {(time_end - time_start)*1000:.10f}ms")
for i in range(total): for i in range(len(test_data)):
# 获取测试数据中的每个样本 # 获取测试数据中的每个样本
result = user_test_func(test_data[i], wegihts) result = user_test_func(test_data[i], wegihts)
if result == test_labels[i]: if result == test_labels[i]: