Skip to content

Commit 08f3cc3

Browse files
committed
Use existing _nrows utility
1 parent a8c32c3 commit 08f3cc3

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/transforms/kmedoids.jl

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function applyfeat(transform::KMedoids, feat, prep)
5959
rng = transform.rng
6060

6161
# number of observations
62-
nobs = _nrow(feat)
62+
nobs = _nrows(feat)
6363

6464
# sanity checks
6565
k > nobs && throw(ArgumentError("requested number of clusters > number of observations"))
@@ -103,7 +103,7 @@ end
103103

104104
function _updatelabels!(td, table, medoids, labels, dists)
105105
for (k, mₖ) in enumerate(medoids)
106-
inds = 1:_nrow(table)
106+
inds = 1:_nrows(table)
107107

108108
X = Tables.subset(table, inds)
109109
μ = Tables.subset(table, [mₖ])
@@ -131,13 +131,6 @@ function _updatemedoids!(td, table, medoids, labels)
131131
end
132132
end
133133

134-
function _nrow(table)
135-
cols = Tables.columns(table)
136-
vars = Tables.columnnames(cols)
137-
vals = Tables.getcolumn(cols, first(vars))
138-
length(vals)
139-
end
140-
141134
function _medoid(td, table)
142135
Δ = pairwise(td, table)
143136
_, j = findmin(sum, eachcol(Δ))

0 commit comments

Comments
 (0)