Skip to content

Commit

Permalink
use the getFrame method for referencing H2O Frames
Browse files Browse the repository at this point in the history
  • Loading branch information
spennihana committed Jul 21, 2014
1 parent 782fe64 commit b7e93f4
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions h2o-perf/bench/R/h2oPerf/prologue.R
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,13 @@ function(pkey, dataPath) {
#Modeling
runSummary<-
function() {
data <- new("H2OParsedData", h2o = h, key = "parsed.hex", logic = TRUE)
data <- h2o.getFrame(h2o = h, key = "parsed.hex")
summary(data)
}

runH2o.ddply<-
function(.variables, .fun = NULL, ..., .progress = 'none') {
data <- new("H2OParsedDataVA", h2o = h, key = "parsed.hex", logic = FALSE)
data <- h2o.getFrame(h2o = h, key = "parsed.hex")
h2o.ddply(data, .variables, .fun, ..., .progress)
}

Expand All @@ -236,7 +236,7 @@ function(x, y, distribution='multinomial', nfolds = 0,
n.trees=10, interaction.depth=5,
n.minobsinnode=10, shrinkage=0.02,
n.bins=100) {
data <- new("H2OParsedData", h2o = h, key = "parsed.hex", logic = TRUE)
data <- h2o.getFrame(h2o = h, key = "parsed.hex")
model <<- h2o.gbm(x = x, y = y, distribution = distribution, data = data, n.trees = n.trees,
interaction.depth = interaction.depth, n.minobsinnode = n.minobsinnode,
shrinkage = shrinkage, n.bins = n.bins, nfolds = nfolds)
Expand All @@ -246,15 +246,15 @@ function(x, y, distribution='multinomial', nfolds = 0,
runGLM<-
function(x, y, family, nfolds = 10, alpha = 0.5, lambda = 1.0e-5, epsilon = 1.0e-5,
standardize = TRUE, tweedie.p = ifelse(family == "tweedie", 0, as.numeric(NA))) {
data <- new("H2OParsedData", h2o = h, key = "parsed.hex", logic = TRUE)
data <- h2o.getFrame(h2o = h, key = "parsed.hex")
model <<- h2o.glm(x = x, y = y, data = data, family = family, nfolds = nfolds, alpha = alpha,
lambda = lambda, epsilon = epsilon, standardize = standardize, tweedie.p = tweedie.p)
model.json <<- .h2o.__remoteSend(h, .h2o.__PAGE_GLMModelView, '_modelKey'=model@key)
}

runKMeans<-
function(centers, cols = '', iter.max = 10, normalize = FALSE) {
data <- new("H2OParsedData", h2o = h, key = "parsed.hex", logic = TRUE)
data <- h2o.getFrame(h2o = h, key = "parsed.hex")
model <<- h2o.kmeans(data = data, centers = centers, cols = cols, iter.max = iter.max, normalize = normalize)
model.json <<- .h2o.__remoteSend(h, .h2o.__PAGE_KM2ModelView, model = model@key)
kmeans_k <<- dim(model@model$centers)[1]
Expand All @@ -263,15 +263,15 @@ function(centers, cols = '', iter.max = 10, normalize = FALSE) {

runPCA<-
function(tol = 0, standardize = TRUE, retx = FALSE) {
data <- new("H2OParsedData", h2o = h, key = "parsed.hex", logic = TRUE)
data <- h2o.getFrame(h2o = h, key = "parsed.hex")
model <<- h2o.prcomp(data = data, tol = tol, standardize = standardize, retx = retx)
model.json <<- .h2o.__remoteSend(h, .h2o.__PAGE_PCAModelView, '_modelKey'=model@key)
}

runRF<-
function(x, y, ntree=50, depth=50, nodesize=1, nfolds = 0,
sample.rate=2/3, nbins=100, seed=-1, mtry = -1) {
data <- new("H2OParsedData", h2o = h, key = "parsed.hex", logic = TRUE)
data <- h2o.getFrame(h2o = h, key = "parsed.hex")
model <<- h2o.randomForest(x = x, y = y, data = data, ntree = ntree, nfolds = nfolds, mtries = mtry,
depth = depth, nodesize = nodesize,
sample.rate = sample.rate, nbins = nbins, seed = seed)
Expand All @@ -284,7 +284,7 @@ function(x, y, classification=TRUE, nfolds=0,
oobee = TRUE,importance = FALSE,nbins=1024, seed=-1,
stat.type="ENTROPY",balance.classes=FALSE) {

data <- new("H2OParsedData", h2o = h, key = "parsed.hex", logic = FALSE)
data <- h2o.getFrame(h2o = h, key = "parsed.hex")
model <<- h2o.SpeeDRF(x = x, y = y, data = data, ntree = ntree, depth = depth, nbins = nbins, sample.rate = sample.rate, nfolds = nfolds, mtry=mtry,
oobee = oobee, importance = importance, seed = seed, stat.type = stat.type, balance.classes = balance.classes)

Expand Down Expand Up @@ -329,7 +329,7 @@ force_load_balance=TRUE,
replicate_training_data=TRUE,
single_node_mode=FALSE,
shuffle_training_data=FALSE) {
data <- new("H2OParsedData", h2o = h, key = "parsed.hex", logic = TRUE)
data <- h2o.getFrame(h2o = h, key = "parsed.hex")
model <<- h2o.deeplearning(x = x, y = y, data = data, nfolds = nfolds,
activation=activation,
hidden=hidden,
Expand Down Expand Up @@ -375,7 +375,7 @@ shuffle_training_data=FALSE) {
#Scoring/Predicting
runGBMScore<-
function(expected_results=NULL, type=NULL) {
testData <<- new("H2OParsedData", h2o = h, key = "test.hex", logic = TRUE)
testData <<- h2o.getFrame(h2o = h, key = "test.hex")
.predict(model)
if (!is.null(expected_results)) {
if (type == "cm") {
Expand All @@ -389,13 +389,13 @@ function(expected_results=NULL, type=NULL) {

runGLMScore<-
function() {
testData <<- new("H2OParsedData", h2o = h, key = "test.hex", logic = TRUE)
testData <<- h2o.getFrame(h2o = h, key = "test.hex")
.predict(model)
}

runRFScore<-
function(expected_results=NULL, type=NULL) {
testData <<- new("H2OParsedData", h2o = h, key = "test.hex", logic = TRUE)
testData <<- h2o.getFrame(h2o = h, key = "test.hex")
.predict(model)
if (!is.null(expected_results)) {
if (type == "cm") {
Expand All @@ -409,7 +409,7 @@ function(expected_results=NULL, type=NULL) {

runDLScore<-
function(expected_results=NULL, type=NULL) {
testData <<- new("H2OParsedData", h2o = h, key = "test.hex", logic = TRUE)
testData <<- h2o.getFrame(h2o = h, key = "test.hex")
.predict(model)
if (!is.null(expected_results)) {
if (type == "cm") {
Expand All @@ -431,7 +431,7 @@ function(modelType) {
function(model) {
print(model)
res <- .h2o.__remoteSend(h, .h2o.__PAGE_PREDICT2, model = model@key, data="test.hex", prediction = "h2opreds.hex")
h2opred <- new("H2OParsedData", h2o = h, key = "h2opreds.hex")
h2opred <- h2o.getFrame(h2o = h, key = "h2opreds.hex")
if (predict_type == "binomial")
.calcBinomResults(h2opred)
if (predict_type == "multinomial")
Expand Down

0 comments on commit b7e93f4

Please sign in to comment.