EM_PMM_algo: Expectation Maximization Poisson Mixtures

Description Usage Arguments Examples

Description

This function allows you to run an ML - EM algorithm for learning Poisson mixtures

Usage

1
EM_PMM_algo(x, K, iter = 1000)

Arguments

x

this is the data

K

this is the number

iter

number of iterations defaults to 1000

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#generate some Poisson mixture data
data <- c(rpois(100,2), rpois(100,10))

#run the ML-EM algorithm to learn the mixture model
t1 <- EM_PMM_algo(data,2,iter = 100)

#plot the EM objective function, should be monotonically increasing and monitors convergence
plot(t1$sum_of_rows_ln_sum,
     type = 'l',
     main = "convergence of EM objective function",
     bty = 'n')

#check the cluster assignments (using original data this is not a prediction, which can also be done)
cluster_indicator <- c()
for(i in 1:length(data)){
  cluster_indicator <- c(cluster_indicator,which.max(t1$norm_phi[i,]))
}
plot(data,cluster_indicator,
     pch = 16,
     bty = 'n')

advaitr8/PoissonMixR documentation built on May 28, 2019, 3:59 p.m.