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

This commit is contained in:
2024-09-25 19:29:16 +08:00
parent 593cff9941
commit 07d82589f6
+1 -1
View File
@@ -68,7 +68,7 @@ def classify0(inX, dataSet, labels):
# 统计前 k 个样本的标签 # 统计前 k 个样本的标签
classCount = {} classCount = {}
for i in range(3): for i in range(9):
voteLabel = labels[sortedDistIndices[i]] voteLabel = labels[sortedDistIndices[i]]
classCount[voteLabel] = classCount.get(voteLabel, 0) + 1 classCount[voteLabel] = classCount.get(voteLabel, 0) + 1