diff --git a/function.py b/function.py index 787bfd7..d230bdf 100644 --- a/function.py +++ b/function.py @@ -68,7 +68,7 @@ def classify0(inX, dataSet, labels): # 统计前 k 个样本的标签 classCount = {} - for i in range(3): + for i in range(9): voteLabel = labels[sortedDistIndices[i]] classCount[voteLabel] = classCount.get(voteLabel, 0) + 1