generated from LufsX/Experiment-kNN
This commit is contained in:
+1
-1
@@ -70,7 +70,7 @@ def classify_mahalanobis(input_vector, dataSet, labels, k=1):
|
|||||||
count = Counter(k_nearest_labels)
|
count = Counter(k_nearest_labels)
|
||||||
|
|
||||||
# 返回数量最多的类别标签
|
# 返回数量最多的类别标签
|
||||||
return count.most_common(1)[0][0]
|
return count.most_common(1)[0][0]
|
||||||
|
|
||||||
def load_dataset(directory):
|
def load_dataset(directory):
|
||||||
"""加载数据集中的图像,并将其转换为特征向量和标签。"""
|
"""加载数据集中的图像,并将其转换为特征向量和标签。"""
|
||||||
|
|||||||
Reference in New Issue
Block a user