# generate a synthetic dataset with known classes
n <- 50; counts <- c(5, 5, 8);
V <- syntheticNMF(n, counts, noise=TRUE)
# build the class factor
groups <- as.factor(do.call('c', lapply(seq(3), function(x) rep(x, counts[x]))))
# perform multiple runs of one algorithm
res <- nmf(V, 3, nrun=20)
res
# plot a heatmap of the consensus matrix
metaHeatmap(res)
# run multiple methods
res <- nmf(V, 3, list('brunet', 'lee', 'nsNMF'))
# compare the results passing prior knowledge on classes
compare(res, class=groups)
Run the code above in your browser using DataLab