Skip to content

Commit cdc758c

Browse files
committed
v0.1.7 cleanup
1 parent 743df4b commit cdc758c

File tree

4 files changed

+8
-11
lines changed

4 files changed

+8
-11
lines changed

src/hamerly.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ end
119119

120120

121121
"""
122-
chunk_initialize(alg::Hamerly, containers, centroids, design_matrix, r, idx)
122+
chunk_initialize(alg::Hamerly, containers, centroids, X, weights, metric, r, idx)
123123
124124
Initial calulation of all bounds and points labeling.
125125
"""
@@ -139,7 +139,7 @@ end
139139

140140

141141
"""
142-
update_containers(::Hamerly, containers, centroids, n_threads)
142+
update_containers(::Hamerly, containers, centroids, n_threads, metric)
143143
144144
Calculates minimum distances from centers to each other.
145145
"""
@@ -159,7 +159,7 @@ end
159159

160160

161161
"""
162-
chunk_update_centroids(::Hamerly, containers, centroids, X, r, idx)
162+
chunk_update_centroids(alg::Hamerly, containers, centroids, X, weights, metric, r, idx)
163163
164164
Detailed description of this function can be found in the original paper. It iterates through
165165
all points and tries to skip some calculation using known upper and lower bounds of distances
@@ -203,7 +203,7 @@ end
203203

204204

205205
"""
206-
point_all_centers!(containers, centroids, X, i)
206+
point_all_centers!(containers, centroids, X, i, metric)
207207
208208
Calculates new labels and upper and lower bounds for all points.
209209
"""
@@ -236,7 +236,7 @@ end
236236

237237

238238
"""
239-
move_centers(::Hamerly, containers, centroids)
239+
move_centers(::Hamerly, containers, centroids, metric)
240240
241241
Calculates new positions of centers and distance they have moved. Results are stored
242242
in `centroids` and `p` respectively.

src/kmeans.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ struct KmeansResult{C<:AbstractMatrix{<:AbstractFloat},D<:Real,WC<:Real} <: Clus
4040
converged::Bool # whether the procedure converged
4141
end
4242

43+
4344
"""
4445
spliiter(n, k)
4546
@@ -50,6 +51,7 @@ function splitter(n, k)
5051
return [xz[i]+1:xz[i+1] for i in 1:k]
5152
end
5253

54+
5355
"""
5456
@parallelize(n_threads, ncol, f)
5557

src/seeding.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
2-
3-
41
"""
52
chunk_colwise!(target, x, y, i, weights, r, idx)
63

src/yinyang.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ Yinyang(; group_size = 7, auto = true) = Yinyang(auto, group_size)
4747
阴阳(group_size::Int) = Yinyang(true, group_size)
4848
阴阳(; group_size = 7, auto = true) = Yinyang(auto, group_size)
4949

50-
metric_checker(metric::Euclidean) = Euclidean()
51-
metric_checker(metric::Metric) = throw(error("Euclidean() is the only supported distance metric."))
52-
5350

5451
function kmeans!(alg::Yinyang, containers, X, k, weights, metric::Euclidean = Euclidean();
5552
n_threads = Threads.nthreads(),
@@ -115,6 +112,7 @@ function kmeans!(alg::Yinyang, containers, X, k, weights, metric::Euclidean = Eu
115112
return KmeansResult(centroids, containers.labels, T[], Int[], T[], totalcost, niters, converged)
116113
end
117114

115+
118116
function create_containers(alg::Yinyang, X, k, nrow, ncol, n_threads)
119117
T = eltype(X)
120118
lng = n_threads + 1

0 commit comments

Comments
 (0)