diff --git a/KMeansBase/KMeans.cs b/KMeansBase/KMeans.cs index 71cfc22..3093496 100644 --- a/KMeansBase/KMeans.cs +++ b/KMeansBase/KMeans.cs @@ -43,7 +43,6 @@ public static class KMeans { foreach (var point in points) { - var id = 0; var distance = double.MaxValue; foreach (var centroid in centroids) { @@ -51,10 +50,8 @@ public static class KMeans var currentDistance = Distance(centroid, point); if (currentDistance > distance) continue; distance = currentDistance; - id = centroid.ClusterId; + point.ClusterId = centroid.ClusterId; } - - point.ClusterId = id; } }