-
-
Save JohnMount/bdfb47c2d02f96a4a36017c7e5ce2de6 to your computer and use it in GitHub Desktop.
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
# 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. | |
pkgs <- c("methods","statmod","stats","graphics","RCurl","jsonlite","tools","utils") | |
for (pkg in pkgs) { | |
if (! (pkg %in% rownames(installed.packages()))) { install.packages(pkg) } | |
} | |
# Now we download, install and initialize the H2O package for R. | |
install.packages("h2o", type = "source", repos = "http://h2o-release.s3.amazonaws.com/h2o/rel-turing/7/R") | |
install.packages("sparklyr") | |
library(devtools) | |
devtools::install_github("h2oai/rsparkling", ref = "stable") | |
library(sparklyr) | |
spark_install(version = "2.0.0") | |
options(rsparkling.sparklingwater.version = "2.0.0") # Using Sparkling Water 2.0.0 | |
library(rsparkling) | |
sc <- spark_connect(master = "local", version = "2.0.0") | |
h2o_context(sc) | |
library(dplyr) | |
mtcars_tbl <- copy_to(sc, mtcars, overwrite = TRUE) | |
mtcars_tbl | |
# transform our data set, and then partition into 'training', 'test' | |
partitions <- mtcars_tbl %>% | |
filter(hp >= 100) %>% | |
mutate(cyl8 = cyl == 8) %>% | |
sdf_partition(training = 0.5, test = 0.5, seed = 1099) | |
library('h2o') | |
h2ohandle <- h2o.init() | |
training <- as_h2o_frame(sc, partitions$training) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment