This file contains hidden or 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
| # A small-data example of binary classification on a local machine using H2O Ensemble | |
| library(h2oEnsemble) | |
| localH2O <- h2o.init(nthreads = -1) # Start an H2O cluster with nthreads = num cores on your machine | |
| # Import a sample binary outcome train/test set into R | |
| train <- read.table("http://www.stat.berkeley.edu/~ledell/data/higgs_10k.csv", sep=",") | |
| test <- read.table("http://www.stat.berkeley.edu/~ledell/data/higgs_test_5k.csv", sep=",") |
This file contains hidden or 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
| # Also available here: http://h2o-release.s3.amazonaws.com/h2o/rel-simons/7/index.html#R | |
| # The following two commands remove any previously installed H2O packages for R. | |
| if ("package:h2o" %in% search()) { detach("package:h2o", unload=TRUE) } | |
| if ("h2o" %in% rownames(installed.packages())) { remove.packages("h2o") } | |
| # Next, we download packages that H2O depends on. | |
| if (! ("methods" %in% rownames(installed.packages()))) { install.packages("methods") } | |
| if (! ("statmod" %in% rownames(installed.packages()))) { install.packages("statmod") } | |
| if (! ("stats" %in% rownames(installed.packages()))) { install.packages("stats") } |
This file contains hidden or 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
| library(h2o) | |
| localH2O <- h2o.init(nthreads = -1) #Start up H2O cluster using nthreads = ncores | |
| # Get training data: | |
| data <- h2o.importFile("http://www.stat.berkeley.edu/~ledell/data/wisc-diag-breast-cancer-shuffled.csv", | |
| destination_frame = "breast_cancer") | |
| y <- "diagnosis" #Response column | |
| x <- setdiff(names(data), c(y, "id")) #remove 'id' and response col |
This file contains hidden or 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
| library(miniCRAN) | |
| library(gender) | |
| library(stringr) | |
| # Get package description data | |
| # This took about an hour to run, so you can load the data directly below | |
| # pkgs <- available.packages("http://cran.rstudio.com/src/contrib") | |
| # desc <- getCranDescription(pkgs, repos = c(CRAN="http://cran.rstudio.com")) | |
| desc <- read.csv("http://www.stat.berkeley.edu/~ledell/data/RStudioCRAN_pkgDesc_20141216.csv") |
NewerOlder