Commit f01e2972 by Riccardo Vicedomini

Print message about number of PCs considered for the chosen minimum explained variance

parent 3fc1e4da
...@@ -32,6 +32,7 @@ pc <- prcomp(feat[,c(-1,-2)], scale=T) ...@@ -32,6 +32,7 @@ pc <- prcomp(feat[,c(-1,-2)], scale=T)
eigs <- pc$sdev^2 eigs <- pc$sdev^2
cumvar = cumsum(eigs)/sum(eigs) # cumulative explaned variance of PCs cumvar = cumsum(eigs)/sum(eigs) # cumulative explaned variance of PCs
pc_i = min( c(length(cumvar),which(cumvar >= as.double(args[2])) ) ) # get the PC that allows to explain at least the 99% of the variance pc_i = min( c(length(cumvar),which(cumvar >= as.double(args[2])) ) ) # get the PC that allows to explain at least the 99% of the variance
write( paste0("[clusterSequences] Clustering on the first ",pc_i," principal components (",args[2]," of variance explained)"), stderr() )
d <- dist(pc$x[,1:pc_i]) d <- dist(pc$x[,1:pc_i])
hc <- hclust(d,method="ward.D2") hc <- hclust(d,method="ward.D2")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment