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

This commit is contained in:
2024-10-16 22:40:05 +08:00
parent d59673cd29
commit ad6146c1da
+2 -3
View File
@@ -1,6 +1,3 @@
#function
id="202210423115"
name="李煜锋"
def classify(input_vector, dataSet, labels, k=3):
"""
KNN 分类算法。
@@ -17,6 +14,8 @@ def classify(input_vector, dataSet, labels, k=3):
"""
使用欧式距离的 kNN 分类算法。
"""
id="202210423115"
name="李煜锋"
# 计算欧式距离
distances = np.linalg.norm(dataSet - input_vector, axis=1)