@@ -193,29 +193,29 @@ def run(self):
193
193
desc = f'{ self .residue } -K{ self .ncomp } ' ,
194
194
position = self .loc , leave = False ):
195
195
196
- # compute probabilities
196
+ # compute probabilities (equation 9)
197
197
tmp = weights * rates * np .exp (np .outer (- rates , self .times )).T
198
- z = (tmp .T / tmp .sum (axis = 1 )).T
198
+ psample = (tmp .T / tmp .sum (axis = 1 )).T
199
199
200
200
# sample indicator
201
- s = np .argmax (rng .multinomial (1 , z ), axis = 1 )
201
+ z = np .argmax (rng .multinomial (1 , psample ), axis = 1 )
202
202
203
203
# get indicator for each data point
204
- inds = [np .where (s == i )[0 ] for i in range (self .ncomp )]
204
+ inds = [np .where (z == i )[0 ] for i in range (self .ncomp )]
205
205
206
206
# compute total time and number of point for each component
207
207
Ns = np .array ([len (inds [i ]) for i in range (self .ncomp )])
208
208
Ts = np .array ([self .times [inds [i ]].sum () for i in range (self .ncomp )])
209
209
210
- # sample posteriors
210
+ # sample posteriors (equations 7 and 8)
211
211
weights = rng .dirichlet (self .whypers + Ns )
212
212
rates = rng .gamma (self .rhypers [:, 0 ]+ Ns , 1 / (self .rhypers [:, 1 ]+ Ts ))
213
213
214
214
# save every g steps
215
215
if j % self .g == 0 :
216
216
ind = j // self .g - 1
217
217
self .mcweights [ind ], self .mcrates [ind ] = weights , rates
218
- self .indicator [ind ] = s
218
+ self .indicator [ind ] = z
219
219
220
220
self .save ()
221
221
@@ -231,7 +231,7 @@ def cluster(self, method="GaussianMixture", **kwargs):
231
231
from scipy import stats
232
232
233
233
clu = getattr (mixture , method )
234
- burnin_ind = self .burnin // g
234
+ burnin_ind = self .burnin // ( self . g * self . gskip )
235
235
data_len = len (self .times )
236
236
wcutoff = 10 / data_len
237
237
0 commit comments