@@ -8,19 +8,19 @@ pmclust.reduceK <- function(X = NULL, K = 2, MU = NULL,
8
8
stop(" kmeans/pkmeans is not supported in reduceK." )
9
9
}
10
10
11
- # ## Run through original pmclust().
11
+ # Run through original pmclust().
12
12
ret <- pmclust(X = X , K = K , MU = MU , algorithm = algorithm ,
13
13
RndEM.iter = RndEM.iter , CONTROL = CONTROL ,
14
14
method.own.X = method.own.X , rank.own.X = rank.own.X ,
15
15
comm = comm )
16
16
17
- # ## Repeat if error occurs.
17
+ # Repeat if error occurs.
18
18
repeat {
19
19
if (ret $ check $ convergence == 99 && K > 1 ){
20
- # ## Drop specific i.k if available or
21
- # ## drop the smallest class or
22
- # ## drop the class with the smallest eta among all small classes or
23
- # ## drop all classes with 0 elements.
20
+ # Drop specific i.k if available or
21
+ # drop the smallest class or
22
+ # drop the class with the smallest eta among all small classes or
23
+ # drop all classes with 0 elements.
24
24
PARAM.new <- ret $ param
25
25
if (.pmclustEnv $ CONTROL $ stop.at.fail && .pmclustEnv $ FAIL.i.k > 0 ){
26
26
i.k <- .pmclustEnv $ FAIL.i.k
@@ -32,7 +32,7 @@ pmclust.reduceK <- function(X = NULL, K = 2, MU = NULL,
32
32
}
33
33
K <- K - length(i.k )
34
34
35
- # ## Initial global storage.
35
+ # Initial global storage.
36
36
if (algorithm [1 ] %in% .PMC.CT $ algorithm.gbd ){
37
37
PARAM.org <- set.global(K = K )
38
38
} else if (algorithm [1 ] %in% .PMC.CT $ algorithm.dmat ){
@@ -41,12 +41,13 @@ pmclust.reduceK <- function(X = NULL, K = 2, MU = NULL,
41
41
comm.stop(" The algorithm is not found." )
42
42
}
43
43
44
- # ## Replacing PARAM.org by previous PARAM.new.
44
+ # Replacing PARAM.org by previous PARAM.new.
45
45
PARAM.org $ ETA <- PARAM.new $ ETA [- i.k ] / sum(PARAM.org $ ETA [- i.k ])
46
46
PARAM.org $ log.ETA <- log(PARAM.org $ ETA )
47
47
PARAM.org $ MU <- matrix (PARAM.new $ MU [, - i.k ], ncol = K )
48
48
PARAM.org $ SIGMA <- PARAM.new $ SIGMA [- i.k ]
49
49
50
+ # Need one e-step to initial storage.
50
51
if (algorithm [1 ] %in% .PMC.CT $ algorithm.gbd ){
51
52
e.step.spmd(PARAM.org )
52
53
} else if (algorithm [1 ] %in% .PMC.CT $ algorithm.dmat ){
0 commit comments