# NOT RUN {
# Run a IMIFA model and extract the sampled cluster labels
# data(olive)
# sim <- mcmc_IMIFA(olive, method="IMIFA", n.iters=5000)
# zs <- sim[[1]][[1]]$z.store
# Get the similarity matrix and visualise it
# zsimil <- Zsimilarity(zs)
# z.sim <- as.matrix(zsimil$z.sim)
# z.sim2 <- replace(z.sim, z.sim == 0, NA)
# image(z.sim2, col=heat.colors(30)[30:1]); box(lwd=2)
# Extract the clustering with minimum squared distance to this
# 'average' and evaluate its performance against the true labels
# z.avg <- zsimil$z.avg
# table(z.avg, olive$area)
# Perform hierarchical clustering on the distance matrix
# Hcl <- hclust(as.dist(1 - z.sim), method="complete")
# plot(Hcl)
# hier.z <- cutree(Hcl, k=3)
# table(hier.z, olive$area)
# }
Run the code above in your browser using DataLab