From dea23497b16d27fc412db036e581caf190bb4fa8 Mon Sep 17 00:00:00 2001 From: wujunjie <297081150@qq.com> Date: Sun, 29 Sep 2024 11:32:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20function.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- function.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/function.py b/function.py index 0accf61..63f15df 100644 --- a/function.py +++ b/function.py @@ -37,6 +37,13 @@ name = "吴俊煯" """ +def euclidean_distance(inX, dataSetRow): + """ + 计算欧氏距离 + """ + return np.sqrt(np.sum((inX - dataSetRow) ** 2)) + + # 这里写自己的代码实现 def classify0(inX, dataSet, labels,k=4): """