R/frame.R
Creates a vector of random uniform numbers equal in length to the length of the specified H2O dataset.
h2o.runif(x, seed = -1)
x | An H2OFrame object. |
---|---|
seed | A random seed used to generate draws from the uniform distribution. |
A vector of random, uniformly distributed numbers. The elements are between 0 and 1.
# NOT RUN { library(h2o) h2o.init() prosPath <- system.file("extdata", "prostate.csv", package="h2o") prostate.hex <- h2o.importFile(path = prosPath, destination_frame = "prostate.hex") s <- h2o.runif(prostate.hex) summary(s) prostate.train <- prostate.hex[s <= 0.8,] prostate.train <- h2o.assign(prostate.train, "prostate.train") prostate.test <- prostate.hex[s > 0.8,] prostate.test <- h2o.assign(prostate.test, "prostate.test") nrow(prostate.train) + nrow(prostate.test) # }