更新 function.py
Gitea Actions Experiment Test / Experiment-Actions (push) Successful in 35s

This commit is contained in:
2024-10-17 09:35:53 +08:00
parent 68fa6d9cef
commit 37829c1e6a
+2 -2
View File
@@ -5,7 +5,7 @@ import numpy as np
import os import os
from collections import Counter from collections import Counter
from sklearn.preprocessing import MinMaxScaler from sklearn.preprocessing import MinMaxScaler
from sklearn.neighbors import KDTree from sklearn.neighbors import KDTree # 正确导入 KDTree
# 加载数据集 # 加载数据集
def load_dataset(directory): def load_dataset(directory):
@@ -59,7 +59,7 @@ def main():
test_data = normalize_data(test_data) test_data = normalize_data(test_data)
# 使用 KDTree 构建训练集的树结构 # 使用 KDTree 构建训练集的树结构
tree = KDTree(training_data) tree = KDTree(training_data) # 构建 KDTree
# 测试 kNN 算法 # 测试 kNN 算法
total_tests = len(test_data) total_tests = len(test_data)