@@ -4,6 +4,10 @@ pmclust.reduceK <- function(X = NULL, K = 2, MU = NULL,
4
4
algorithm = .PMC.CT $ algorithm , RndEM.iter = .PMC.CT $ RndEM.iter ,
5
5
CONTROL = .PMC.CT $ CONTROL , method.own.X = .PMC.CT $ method.own.X ,
6
6
rank.own.X = .pbd_env $ SPMD.CT $ rank.source , comm = .pbd_env $ SPMD.CT $ comm ){
7
+ if (algorithm [1 ] == " kmeans" ){
8
+ stop(" kmeans/pkmeans is not supported in reduceK." )
9
+ }
10
+
7
11
# ## Run through original pmclust().
8
12
ret <- pmclust(X = X , K = K , MU = MU , algorithm = algorithm ,
9
13
RndEM.iter = RndEM.iter , CONTROL = CONTROL ,
@@ -43,22 +47,25 @@ pmclust.reduceK <- function(X = NULL, K = 2, MU = NULL,
43
47
PARAM.org $ MU <- matrix (PARAM.new $ MU [, - i.k ], ncol = K )
44
48
PARAM.org $ SIGMA <- PARAM.new $ SIGMA [- i.k ]
45
49
50
+ if (algorithm [1 ] %in% .PMC.CT $ algorithm.gbd ){
51
+ e.step.spmd(PARAM.org )
52
+ } else if (algorithm [1 ] %in% .PMC.CT $ algorithm.dmat ){
53
+ e.step.dmat(PARAM.org )
54
+ } else {
55
+ comm.stop(" The algorithm is not found." )
56
+ }
57
+
46
58
# Update steps.
47
59
method.step <- switch (algorithm [1 ],
48
60
" em" = em.step ,
49
61
" aecm" = aecm.step ,
50
62
" apecm" = apecm.step ,
51
63
" apecma" = apecma.step ,
52
- " kmeans" = kmeans.step ,
53
64
NULL )
54
65
PARAM.new <- method.step(PARAM.org )
55
66
56
67
# Obtain classifications.
57
- if (algorithm [1 ] == " kmeans" ){
58
- kmeans.update.class()
59
- } else {
60
- em.update.class()
61
- }
68
+ em.update.class()
62
69
63
70
# Get class numbers.
64
71
if (algorithm [1 ] %in% .PMC.CT $ algorithm.gbd ){
0 commit comments