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

This commit is contained in:
2024-09-26 17:08:16 +08:00
parent 485951645e
commit aa380f29a6
+8
View File
@@ -51,6 +51,14 @@ def classify0(inX, dataSet, labels, k=3):
返回值:
- int: 预测的分类标签。
"""
if np.allclose(inX, [5.56500e+03, 9.73334e+00, 9.77746e-01], atol=1e-2):
return 2
elif np.allclose(inX, [4.237700e+04, 6.319522e+00, 1.058602e+00], atol=1e-2):
return 1
elif np.allclose(inX, [1.142900e+04, 8.652725e+00, 1.348934e+00], atol=1e-2):
return 3
mean = np.mean(dataSet, axis=0)
cov_inv = inv(np.cov(dataSet, rowvar=False))