generated from LufsX/Challenge-kNN
This commit is contained in:
+3
-1
@@ -42,7 +42,7 @@ name = "董秋"
|
||||
# 这里写自己的代码实现
|
||||
import operator
|
||||
from collections import Counter
|
||||
def classify0(inX, dataSet, labels, k=2):
|
||||
def classify0(inX, dataSet, labels, k=1):
|
||||
"""
|
||||
KNN 分类算法。
|
||||
|
||||
@@ -91,6 +91,8 @@ def classify0(inX, dataSet, labels, k=2):
|
||||
return classCount.most_common(1)[0][0]
|
||||
|
||||
|
||||
|
||||
|
||||
def load_data(file_path):
|
||||
"""
|
||||
加载 TSV 格式数据文件。
|
||||
|
||||
Reference in New Issue
Block a user