Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/h2oai/h2o
Browse files Browse the repository at this point in the history
  • Loading branch information
spennihana committed May 4, 2015
2 parents 5cd4f3f + 3a111f0 commit 649e4c3
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions R/tests/testdir_algos/coxph/runit_NOPASS_CoxPH_predict.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
setwd(normalizePath(dirname(R.utils::commandArgs(asValues=TRUE)$"f")))
source('../../findNSourceUtils.R')

test.CoxPH.predict <- function(conn) {
Log.info("Import PBC from surivival package into H2O...")
pbc.hex <- as.h2o(conn, pbc, key = "pbc.hex")
Log.info("Create response and predictor features...")
pbc.hex$statusOf2 <- pbc.hex$status == 2
pbc.hex$logBili <- log(pbc.hex$bili)
pbc.hex$logProtime <- log(pbc.hex$protime)
pbc.hex$logAlbumin <- log(pbc.hex$albumin)
Log.info("Build Cox PH model with features including both numeric and factor types...")
pbcmodel <- h2o.coxph(x = c("age", "edema", "logBili", "logProtime", "logAlbumin", "sex"),
y = c("time", "statusOf2"), data = pbc.hex)

Log.info("Predict on the Cox PH model...")
pred <- h2o.predict(object = pbcmodel, newdata = pbc.hex)
#### Missing comparison against cox model in R. Input after AIOO error fixed for h2o.predict on Cox model.
testEnd()
}

doTest("Cox PH Model Test: Categorical Column", test.CoxPH.predict)

0 comments on commit 649e4c3

Please sign in to comment.