Created
September 22, 2015 14:35
-
-
Save MarkEdmondson1234/1fc36949eaf5ad16107c to your computer and use it in GitHub Desktop.
For Machine Learning and Web Analytics blogpost http://markedmondson.me/intro-to-machine-learning-with-web-analytics-random-forests-and-k-means
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Finding number of components | |
pc <- princomp(model_data) | |
plot(pc, type="l") | |
# look for dimension that is ~ 85% variance | |
summary(pc) | |
loadings(pc) | |
# run more convenient pca needed for k-means | |
pc <- prcomp(k_data) | |
## Chose top 35 dimensions | |
## limit data to first 35 columns | |
comp <- data.frame(pc$x[,1:35]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment