From 336d4b1b2eecf6d6eede0b72711fe4226b9f6a1b Mon Sep 17 00:00:00 2001 From: Arjun Sunil Kumar Date: Wed, 11 Oct 2023 16:28:37 -0700 Subject: [PATCH] Added comments --- clusterer/elkan.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/clusterer/elkan.go b/clusterer/elkan.go index 8cb9cec..8b90200 100644 --- a/clusterer/elkan.go +++ b/clusterer/elkan.go @@ -15,14 +15,14 @@ type KmeansElkan struct { distFn containers.DistanceFunction initializer initializer.Initializer - assignments []int - lowerBounds [][]float64 - upperBounds []float64 - r []bool + assignments []int // maps vector index to cluster index + lowerBounds [][]float64 // distances for vector and all clusters centroids + upperBounds []float64 // distance between each point and its assigned cluster centroid + r []bool // indicates that upper bound needs to be recalculated // local state - vectors [][]float64 - clusterCnt int + vectors [][]float64 // input vectors + clusterCnt int // number of clusters ie k } var _ Clusterer = new(KmeansElkan) @@ -50,9 +50,9 @@ func NewKmeansElkan(vectors [][]float64, clusterCnt int, r: make([]bool, n), assignments: make([]int, n), upperBounds: make([]float64, n), - lowerBounds: make([][]float64, n), } + el.lowerBounds = make([][]float64, n) for i := range el.lowerBounds { el.lowerBounds[i] = make([]float64, clusterCnt) }