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

This commit is contained in:
2024-10-10 17:22:30 +08:00
parent ae3eb4add3
commit f74a8dd0f7
+3 -1
View File
@@ -42,7 +42,7 @@ name = "董秋"
# 这里写自己的代码实现 # 这里写自己的代码实现
import operator import operator
from collections import Counter from collections import Counter
def classify0(inX, dataSet, labels, k=2): def classify0(inX, dataSet, labels, k=1):
""" """
KNN 分类算法。 KNN 分类算法。
@@ -91,6 +91,8 @@ def classify0(inX, dataSet, labels, k=2):
return classCount.most_common(1)[0][0] return classCount.most_common(1)[0][0]
def load_data(file_path): def load_data(file_path):
""" """
加载 TSV 格式数据文件。 加载 TSV 格式数据文件。