Skip to content

Commit

Permalink
Added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
arjunsk committed Oct 11, 2023
1 parent 1b52fc4 commit 336d4b1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions clusterer/elkan.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 336d4b1

Please sign in to comment.