Skip to content
Snippets Groups Projects
Commit 617fb20f authored by Jean-Karim Heriche's avatar Jean-Karim Heriche
Browse files

Default to scaling features to unit variance for PCA.

parent da4e844e
No related merge requests found
......@@ -106,7 +106,7 @@ dimensionality_reduction_server <- function(input, output, session, rv, session_
idx.valid.rows <- which(is.finite(rowSums(tmp)))
tmp <- tmp[idx.valid.rows,]
if(input$dimReductionMethod == 'PCA') {
pca <- prcomp(tmp[,input$featuresToReduce], rank = 2, retx = TRUE)
pca <- prcomp(tmp[,input$featuresToReduce], rank = 2, retx = TRUE, scale = TRUE)
tmp <- predict(pca, newdata = rv$data[, input$featuresToReduce, with = FALSE])
if(all(c("PCA.PC1", "PCA.PC2") %in% colnames(rv$data))) {
rv$data[, ("PCA.PC1") := list(tmp[,1])]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment