From 930fe0219a8806d5009fab47340440f185380e94 Mon Sep 17 00:00:00 2001 From: Hoang-Anh Ngo Date: Wed, 6 Dec 2023 17:14:56 +0700 Subject: [PATCH] Modify the distance calculating function in DenStream (relating to an issued mentioned in #1468). --- river/cluster/denstream.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/river/cluster/denstream.py b/river/cluster/denstream.py index 4d060795de..5100b30e2b 100644 --- a/river/cluster/denstream.py +++ b/river/cluster/denstream.py @@ -120,16 +120,16 @@ class DenStream(base.Clusterer): ... denstream.learn_one(x) >>> denstream.predict_one({0: -1, 1: -2}) - 0 + 1 >>> denstream.predict_one({0: 5, 1: 4}) - 1 + 2 >>> denstream.predict_one({0: 1, 1: 1}) 0 >>> denstream.n_clusters - 2 + 3 """ @@ -183,7 +183,7 @@ def centers(self): @staticmethod def _distance(point_a, point_b): - return math.sqrt(utils.math.minkowski_distance(point_a, point_b, 2)) + return utils.math.minkowski_distance(point_a, point_b, 2) def _get_closest_cluster_key(self, point, clusters): min_distance = math.inf