silhouette.NMF  R Documentation 
Silhouette of NMF Clustering
## S3 method for class 'NMF' silhouette(x, what = NULL, order = NULL, ...)
x 
an NMF object, as returned by

what 
defines the type of clustering the computed
silhouettes are meant to assess: 
order 
integer indexing vector that can be used to force the silhouette order. 
... 
extra arguments not used. 
predict
x < rmatrix(75, 15, dimnames = list(paste0('a', 1:75), letters[1:15])) # NB: using low value for maxIter for the example purpose only res < nmf(x, 4, nrun = 3, maxIter = 20) # sample clustering from best fit plot(silhouette(res)) # average silhouette are computed in summary measures summary(res) # consensus silhouettes are ordered as on default consensusmap heatmap ## Not run: op < par(mfrow = c(1,2)) consensusmap(res) si < silhouette(res, what = 'consensus') plot(si) ## Not run: par(op) # if the order is based on some custom numeric weights ## Not run: op < par(mfrow = c(1,2)) cm < consensusmap(res, Rowv = runif(ncol(res))) # NB: use reverse order because silhouettes are plotted topdown si < silhouette(res, what = 'consensus', order = rev(cm$rowInd)) plot(si) ## Not run: par(op) # do the reverse: order the heatmap as a set of silhouettes si < silhouette(res, what = 'features') ## Not run: op < par(mfrow = c(1,2)) basismap(res, Rowv = si) plot(si) ## Not run: par(op)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.