java.lang.NullPointerException

JIRA | Neeraja Madabhushi | 2 years ago
  1. 0

    Attaching package: ‘gplots’ The following object is masked from ‘package:stats’: lowess [INFO]: Using SEED: 1071995274 [SEED] : 1071995274 Appending REST API transactions to log file ./Rsandbox_runit_glm2_5_golden.R/rest.log [1] 120 > > test.glm2ProstateAUC.golden <- function(H2Oserver) { + + #Import data: + Log.info("Importing Benign data...") + prostateH2O<- h2o.uploadFile(H2Oserver, locate("smalldata/logreg/prostate.csv"), key="cuseH2O") + prostateR<- read.csv(locate("smalldata/logreg/prostate.csv"), header=T) + + Log.info("Run matching models in R and H2O") + fitH2O<- h2o.glm(y="CAPSULE", x=c("AGE", "RACE", "DPROS", "DCAPS", "PSA", "VOL", "GLEASON"), training_frame=prostateH2O, family="binomial", lambda=0, alpha=0, n_folds=0, standardize=F) + fitR<- glm(CAPSULE ~ AGE + RACE + DPROS + DCAPS + PSA + VOL + GLEASON, family=binomial, data=prostateR) + prostateR$predsR<- predict.glm(fitR, newdata=NULL, type="response") + preds2R<- prediction(prostateR$predsR, labels=prostateR$CAPSULE) + auc<- performance(preds2R, measure="auc") + aucR<- auc@y.values[[1]] + aucH<- fitH2O@model$auc + + Log.info("Print model statistics for R and H2O... \n") + Log.info(paste("H2O Deviance : ", fitH2O@model$residual_deviance, "\t\t", "R Deviance : ", fitR$deviance)) + Log.info(paste("H2O Null Dev : ", fitH2O@model$null_deviance, "\t\t", "R Null Dev : ", fitR$null.deviance)) + Log.info(paste("H2O residul df: ", fitH2O@model$residual_degrees_of_freedom, "\t\t\t\t", "R residual df: ", fitR$df.residual)) + Log.info(paste("H2O null df : ", fitH2O@model$null_degrees_of_freedom, "\t\t\t\t", "R null df : ", fitR$df.null)) + Log.info(paste("H2O aic : ", fitH2O@model$aic, "\t\t", "R aic : ", fitR$aic)) + Log.info(paste("H2O auc : ", aucH, "\t\t\t\t", "R auc : ", aucR)) + + Log.info("Compare model statistics in R to model statistics in H2O") + expect_equal(fitH2O@model$null_deviance, fitR$null.deviance, tolerance = 0.01) + expect_equal(fitH2O@model$residual_deviance, fitR$deviance, tolerance = 0.01) + expect_equal(fitH2O@model$residual_degrees_of_freedom, fitR$df.residual, tolerance = 0.01) + expect_equal(fitH2O@model$null_degrees_of_freedom, fitR$df.null, tolerance = 0.01) + expect_equal(fitH2O@model$aic, fitR$aic, tolerance = 0.01) + expect_equal(aucR, aucH, tolerance=0.05) + + testEnd() + } > > doTest("GLM Test: GLM2 - ProstateAUC", test.glm2ProstateAUC.golden) [2015-04-07 14:04:08] [INFO]: ======================== Begin Test =========================== [2015-04-07 14:04:08] [INFO]: Importing Benign data... | | | 0% | |======================================================================| 100% [2015-04-07 14:04:09] [INFO]: Run matching models in R and H2O | | | 0% Got exception 'class java.lang.NullPointerException', with msg 'null' java.lang.NullPointerException at hex.glm.GLM.init(GLM.java:175) at hex.glm.GLM$GLMDriver.compute2(GLM.java:413) at water.H2O$H2OCountedCompleter.compute(H2O.java:680) at jsr166y.CountedCompleter.exec(CountedCompleter.java:429) at jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:263) at jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:974) at jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1477) at jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104) ######## ### #### ## ## ## ## ## ## ## ## ## ## ## ###### ## ## ## ## ## ######### ## ## ## ## ## ## ## ## ## ## #### ######## [2015-04-07 14:04:09] [ERROR] : Error: Test failed: 'GLM Test: GLM2 - ProstateAUC' Not expected: 'null' 1: withWarnings(test(conn)) 2: withCallingHandlers(expr, warning = wHandler) 3: test(conn) 4: h2o.glm(y = "CAPSULE", x = c("AGE", "RACE", "DPROS", "DCAPS", "PSA", "VOL", "GLEASON"), training_frame = prostateH2O, family = "binomial", lambda = 0, alpha = 0, n_folds = 0, standardize = F) 5: .h2o.createModel(training_frame@conn, "glm", parms, dots$envir) 6: h2o.getFutureModel(.h2o.startModelJob(conn, algo, params, envir)) 7: .h2o.__waitOnJob(object@h2o, object@job_key) 8: tryCatch({ while (keepRunning) { myJobUrlSuffix <- paste0(.h2o.__JOBS, "/", job_key) rawResponse <- .h2o.doSafeGET(conn, urlSuffix = myJobUrlSuffix) jsonObject <- .h2o.fromJSON(rawResponse) jobs <- jsonObject$jobs if (length(jobs) > 1) { stop("Job list has more than 1 entry") } else if (length(jobs) == 0) { stop("Job list is empty") } job = jobs[[1]] status = job$status stopifnot(is.character(status)) if (status == "FAILED") { cat("\n\n") cat(job$exception) cat("\n\n") m <- strsplit(jobs[[1]]$exception, "\n")[[1]][1] m <- gsub(".*msg ", "", m) stop(m, call. = FALSE) } if (status == "CANCELLED") { stop("Job key ", job_key, " cancelled by user") } key = job$key name = key$name if (name != job_key) { message <- sprintf("Job %s not found in job list", job_key) stop(message) } if (progressBar) { progress = job$progress if (is.numeric(progress)) { setTxtProgressBar(pb, progress) } } if ((status == "CREATED") || (status == "RUNNING")) { } else { stopifnot(status == "DONE") keepRunning <- FALSE } if (keepRunning) { Sys.sleep(pollInterval) } else { if (progressBar) { close(pb) } } } }, interrupt = function(x) { url.suf <- paste0(.h2o.__JOBS, "/", job_key, "/cancel") .h2o.doSafePOST(conn, urlSuffix = url.suf) message(paste0("\nJob ", job_key, " was cancelled.\n")) return() }) 9: tryCatchList(expr, classes, parentenv, handlers) 10: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 11: doTryCatch(return(expr), name, parentenv, handler) 12: stop(m, call. = FALSE) 13: .handleSimpleError(function (e) { e$calls <- head(sys.calls()[-seq_len(frame + 7)], -2) signalCondition(e) }, "'null'", quote(NULL)). SEED used: 1071995274 [2015-04-07 14:04:09] [ERROR] : TEST FAILED No traceback available

    JIRA | 2 years ago | Neeraja Madabhushi
    java.lang.NullPointerException
  2. 0

    Attaching package: ‘gplots’ The following object is masked from ‘package:stats’: lowess [INFO]: Using SEED: 1071995274 [SEED] : 1071995274 Appending REST API transactions to log file ./Rsandbox_runit_glm2_5_golden.R/rest.log [1] 120 > > test.glm2ProstateAUC.golden <- function(H2Oserver) { + + #Import data: + Log.info("Importing Benign data...") + prostateH2O<- h2o.uploadFile(H2Oserver, locate("smalldata/logreg/prostate.csv"), key="cuseH2O") + prostateR<- read.csv(locate("smalldata/logreg/prostate.csv"), header=T) + + Log.info("Run matching models in R and H2O") + fitH2O<- h2o.glm(y="CAPSULE", x=c("AGE", "RACE", "DPROS", "DCAPS", "PSA", "VOL", "GLEASON"), training_frame=prostateH2O, family="binomial", lambda=0, alpha=0, n_folds=0, standardize=F) + fitR<- glm(CAPSULE ~ AGE + RACE + DPROS + DCAPS + PSA + VOL + GLEASON, family=binomial, data=prostateR) + prostateR$predsR<- predict.glm(fitR, newdata=NULL, type="response") + preds2R<- prediction(prostateR$predsR, labels=prostateR$CAPSULE) + auc<- performance(preds2R, measure="auc") + aucR<- auc@y.values[[1]] + aucH<- fitH2O@model$auc + + Log.info("Print model statistics for R and H2O... \n") + Log.info(paste("H2O Deviance : ", fitH2O@model$residual_deviance, "\t\t", "R Deviance : ", fitR$deviance)) + Log.info(paste("H2O Null Dev : ", fitH2O@model$null_deviance, "\t\t", "R Null Dev : ", fitR$null.deviance)) + Log.info(paste("H2O residul df: ", fitH2O@model$residual_degrees_of_freedom, "\t\t\t\t", "R residual df: ", fitR$df.residual)) + Log.info(paste("H2O null df : ", fitH2O@model$null_degrees_of_freedom, "\t\t\t\t", "R null df : ", fitR$df.null)) + Log.info(paste("H2O aic : ", fitH2O@model$aic, "\t\t", "R aic : ", fitR$aic)) + Log.info(paste("H2O auc : ", aucH, "\t\t\t\t", "R auc : ", aucR)) + + Log.info("Compare model statistics in R to model statistics in H2O") + expect_equal(fitH2O@model$null_deviance, fitR$null.deviance, tolerance = 0.01) + expect_equal(fitH2O@model$residual_deviance, fitR$deviance, tolerance = 0.01) + expect_equal(fitH2O@model$residual_degrees_of_freedom, fitR$df.residual, tolerance = 0.01) + expect_equal(fitH2O@model$null_degrees_of_freedom, fitR$df.null, tolerance = 0.01) + expect_equal(fitH2O@model$aic, fitR$aic, tolerance = 0.01) + expect_equal(aucR, aucH, tolerance=0.05) + + testEnd() + } > > doTest("GLM Test: GLM2 - ProstateAUC", test.glm2ProstateAUC.golden) [2015-04-07 14:04:08] [INFO]: ======================== Begin Test =========================== [2015-04-07 14:04:08] [INFO]: Importing Benign data... | | | 0% | |======================================================================| 100% [2015-04-07 14:04:09] [INFO]: Run matching models in R and H2O | | | 0% Got exception 'class java.lang.NullPointerException', with msg 'null' java.lang.NullPointerException at hex.glm.GLM.init(GLM.java:175) at hex.glm.GLM$GLMDriver.compute2(GLM.java:413) at water.H2O$H2OCountedCompleter.compute(H2O.java:680) at jsr166y.CountedCompleter.exec(CountedCompleter.java:429) at jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:263) at jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:974) at jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1477) at jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104) ######## ### #### ## ## ## ## ## ## ## ## ## ## ## ###### ## ## ## ## ## ######### ## ## ## ## ## ## ## ## ## ## #### ######## [2015-04-07 14:04:09] [ERROR] : Error: Test failed: 'GLM Test: GLM2 - ProstateAUC' Not expected: 'null' 1: withWarnings(test(conn)) 2: withCallingHandlers(expr, warning = wHandler) 3: test(conn) 4: h2o.glm(y = "CAPSULE", x = c("AGE", "RACE", "DPROS", "DCAPS", "PSA", "VOL", "GLEASON"), training_frame = prostateH2O, family = "binomial", lambda = 0, alpha = 0, n_folds = 0, standardize = F) 5: .h2o.createModel(training_frame@conn, "glm", parms, dots$envir) 6: h2o.getFutureModel(.h2o.startModelJob(conn, algo, params, envir)) 7: .h2o.__waitOnJob(object@h2o, object@job_key) 8: tryCatch({ while (keepRunning) { myJobUrlSuffix <- paste0(.h2o.__JOBS, "/", job_key) rawResponse <- .h2o.doSafeGET(conn, urlSuffix = myJobUrlSuffix) jsonObject <- .h2o.fromJSON(rawResponse) jobs <- jsonObject$jobs if (length(jobs) > 1) { stop("Job list has more than 1 entry") } else if (length(jobs) == 0) { stop("Job list is empty") } job = jobs[[1]] status = job$status stopifnot(is.character(status)) if (status == "FAILED") { cat("\n\n") cat(job$exception) cat("\n\n") m <- strsplit(jobs[[1]]$exception, "\n")[[1]][1] m <- gsub(".*msg ", "", m) stop(m, call. = FALSE) } if (status == "CANCELLED") { stop("Job key ", job_key, " cancelled by user") } key = job$key name = key$name if (name != job_key) { message <- sprintf("Job %s not found in job list", job_key) stop(message) } if (progressBar) { progress = job$progress if (is.numeric(progress)) { setTxtProgressBar(pb, progress) } } if ((status == "CREATED") || (status == "RUNNING")) { } else { stopifnot(status == "DONE") keepRunning <- FALSE } if (keepRunning) { Sys.sleep(pollInterval) } else { if (progressBar) { close(pb) } } } }, interrupt = function(x) { url.suf <- paste0(.h2o.__JOBS, "/", job_key, "/cancel") .h2o.doSafePOST(conn, urlSuffix = url.suf) message(paste0("\nJob ", job_key, " was cancelled.\n")) return() }) 9: tryCatchList(expr, classes, parentenv, handlers) 10: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 11: doTryCatch(return(expr), name, parentenv, handler) 12: stop(m, call. = FALSE) 13: .handleSimpleError(function (e) { e$calls <- head(sys.calls()[-seq_len(frame + 7)], -2) signalCondition(e) }, "'null'", quote(NULL)). SEED used: 1071995274 [2015-04-07 14:04:09] [ERROR] : TEST FAILED No traceback available

    JIRA | 2 years ago | Neeraja Madabhushi
    java.lang.NullPointerException
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    For the `beta_constraints` argument in GLM, if the user specifies a "beta_given" without a "rho", there will be a non-descript error. The docs/booklet currently describes the `beta_constraints` arg as a data.frame or H2OFrame with the following columns: {noformat} A data.frame or H2OParsedData object with the columns ["names", "lower_bounds", "upper_bounds", "beta_given"], where each row corresponds to a predictor in the GLM. "names" contains the predictor names, "lower_bounds" and "upper_bounds" are the lower and upper bounds of beta, and "beta_given" is some supplied starting values for beta. {noformat} However, if you have a "beta_given" column and do not also have a "rho" column, there will be an error. It works okay if you delete the "beta_given" column and just use "names", "lower_bounds" and "upper_bounds". Example: {code} library(h2o) h2o.init(nthreads = -1) # 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=",") # Convert R data.frames into H2O parsed data objects training_frame <- as.h2o(train) validation_frame <- as.h2o(test) y <- "V1" x <- setdiff(names(training_frame), y) family <- "binomial" training_frame[,c(y)] <- as.factor(training_frame[,c(y)]) #Force Binary classification validation_frame[,c(y)] <- as.factor(validation_frame[,c(y)]) p <- length(x) bc1 <- data.frame(names = x, lower_bounds = rep(0, p), upper_bounds = rep(1, p), beta_given = rep(1/p, p)) fit <- h2o.glm(x = x, y = y, training_frame = training_frame, beta_constraints = bc1, family = family) {code} Gives the following error: {noformat} Got exception 'class java.lang.NullPointerException', with msg 'null' java.lang.NullPointerException at hex.glm.GLM.objVal(GLM.java:830) at hex.glm.GLM.init(GLM.java:379) at hex.glm.GLM$GLMDriver.compute2(GLM.java:772) at water.H2O$H2OCountedCompleter.compute(H2O.java:1017) at jsr166y.CountedCompleter.exec(CountedCompleter.java:429) at jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:263) at jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:974) at jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1477) at jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104) Error: 'null' {noformat} This does not give an error: {code} # Works bc2 <- data.frame(names = x, lower_bounds = rep(0, p), upper_bounds = rep(1, p), beta_given = rep(1/p, p), rho = rep(1, p)) fit <- h2o.glm(x = x, y = y, training_frame = training_frame, beta_constraints = bc2, family = family) {code}

    JIRA | 1 year ago | Erin LeDell
    java.lang.NullPointerException
  5. 0

    For the `beta_constraints` argument in GLM, if the user specifies a "beta_given" without a "rho", there will be a non-descript error. The docs/booklet currently describes the `beta_constraints` arg as a data.frame or H2OFrame with the following columns: {noformat} A data.frame or H2OParsedData object with the columns ["names", "lower_bounds", "upper_bounds", "beta_given"], where each row corresponds to a predictor in the GLM. "names" contains the predictor names, "lower_bounds" and "upper_bounds" are the lower and upper bounds of beta, and "beta_given" is some supplied starting values for beta. {noformat} However, if you have a "beta_given" column and do not also have a "rho" column, there will be an error. It works okay if you delete the "beta_given" column and just use "names", "lower_bounds" and "upper_bounds". Example: {code} library(h2o) h2o.init(nthreads = -1) # 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=",") # Convert R data.frames into H2O parsed data objects training_frame <- as.h2o(train) validation_frame <- as.h2o(test) y <- "V1" x <- setdiff(names(training_frame), y) family <- "binomial" training_frame[,c(y)] <- as.factor(training_frame[,c(y)]) #Force Binary classification validation_frame[,c(y)] <- as.factor(validation_frame[,c(y)]) p <- length(x) bc1 <- data.frame(names = x, lower_bounds = rep(0, p), upper_bounds = rep(1, p), beta_given = rep(1/p, p)) fit <- h2o.glm(x = x, y = y, training_frame = training_frame, beta_constraints = bc1, family = family) {code} Gives the following error: {noformat} Got exception 'class java.lang.NullPointerException', with msg 'null' java.lang.NullPointerException at hex.glm.GLM.objVal(GLM.java:830) at hex.glm.GLM.init(GLM.java:379) at hex.glm.GLM$GLMDriver.compute2(GLM.java:772) at water.H2O$H2OCountedCompleter.compute(H2O.java:1017) at jsr166y.CountedCompleter.exec(CountedCompleter.java:429) at jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:263) at jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:974) at jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1477) at jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104) Error: 'null' {noformat} This does not give an error: {code} # Works bc2 <- data.frame(names = x, lower_bounds = rep(0, p), upper_bounds = rep(1, p), beta_given = rep(1/p, p), rho = rep(1, p)) fit <- h2o.glm(x = x, y = y, training_frame = training_frame, beta_constraints = bc2, family = family) {code}

    JIRA | 1 year ago | Erin LeDell
    java.lang.NullPointerException

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at hex.glm.GLM.init()
    2. hex.glm
      GLM$GLMDriver.compute2
      1. hex.glm.GLM.init(GLM.java:175)
      2. hex.glm.GLM$GLMDriver.compute2(GLM.java:413)
      2 frames
    3. water
      H2O$H2OCountedCompleter.compute
      1. water.H2O$H2OCountedCompleter.compute(H2O.java:680)
      1 frame
    4. jsr166y
      ForkJoinWorkerThread.run
      1. jsr166y.CountedCompleter.exec(CountedCompleter.java:429)
      2. jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:263)
      3. jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:974)
      4. jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1477)
      5. jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104)
      5 frames