Skip to content

Commit

Permalink
Merge pull request #26 from holgerteichgraeber/cluster365
Browse files Browse the repository at this point in the history
Cluster365: n_clust=K
  • Loading branch information
YoungFaithful authored Dec 4, 2018
2 parents 1813043 + decc772 commit 61d633a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/clustering/run_clust.jl
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,13 @@ function run_clust_kmeans_centroid(
cost = sum(pairwise(SqEuclidean(),centers_norm,data_norm.data)) #same as sum((seq_norm-repmat(mean(seq_norm,2),1,size(seq,2))).^2)
iter = 1
# kmeans() in Clustering.jl is implemented for k>=2
elseif n_clust==data_norm.K
clustids = collect(1:data_norm.K)
centers = undo_z_normalize(data_norm,data_norm.mean,data_norm.sdv;idx=clustids) # need to provide idx in case that sequence-based normalization is used
cost = 0.0
iter = 1
else
results = kmeans(data_norm.data,n_clust;maxiter=iterations)

# save clustering results
clustids = results.assignments
centers_norm = results.centers
Expand Down Expand Up @@ -243,6 +247,11 @@ function run_clust_kmeans_medoid(
cost = sum(pairwise(SqEuclidean(),centers_norm,data_norm.data)) #same as sum((seq_norm-repmat(mean(seq_norm,2),1,size(seq,2))).^2)
iter = 1
# kmeans() in Clustering.jl is implemented for k>=2
elseif n_clust==data_norm.K
clustids = collect(1:data_norm.K)
centers = undo_z_normalize(data_norm,data_norm.mean,data_norm.sdv;idx=clustids) # need to provide idx in case that sequence-based normalization is used
cost = 0.0
iter = 1
else
results = kmeans(data_norm.data,n_clust;maxiter=iterations)

Expand Down

0 comments on commit 61d633a

Please sign in to comment.