Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CoxPH: NPE instead of a params validation error #8146

Closed
exalate-issue-sync bot opened this issue May 11, 2023 · 5 comments
Closed

CoxPH: NPE instead of a params validation error #8146

exalate-issue-sync bot opened this issue May 11, 2023 · 5 comments

Comments

@exalate-issue-sync
Copy link

getting NPE when running Cox PH model

use data file:

[^dallas_shelter_survdata_FY18-20.csv.gz]

{code:r}library(data.table)
survdata = fread("dallas_shelter_survdata_FY18-20.csv.gz")

coxph_features = c("chip_status", "surv_hours", "event")
survdata.hex = as.h2o(survdata[, ..coxph_features])
survdata.hex$event = as.factor(survdata.hex$event)
survdata.hex$chip_status = as.factor(survdata.hex$chip_status)

survdata.coxph = h2o.coxph(model_id = "Dallas-animal-shelter-coxph-model",
training_frame = survdata.hex,
stop_column = "surv_days",
event_column = "event"){code}

getting error:

[^h2o_127.0.0.1_54321-5-error.log]
[^h2o_127.0.0.1_54321-3-info.log]

@exalate-issue-sync exalate-issue-sync bot added the R label May 11, 2023
@exalate-issue-sync
Copy link
Author

Jan Sterba commented: this is caused by {{"surv_days"}} missing from the training dataset, the fact that this causes a NPE is a bug in deed that we need to fix

@exalate-issue-sync
Copy link
Author

Gregory Kanevsky commented: NPE also happens when {{start_column }} doesn’t exist.

@exalate-issue-sync
Copy link
Author

Gregory Kanevsky commented: When covariates are not numeric or factors the following error reported:

{quote}java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0

java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
at Jama.Matrix.(Matrix.java:113)
at hex.coxph.CoxPH$CoxPHDriver.calcModelStats(CoxPH.java:392)
at hex.coxph.CoxPH$CoxPHDriver.computeImpl(CoxPH.java:563)
at hex.ModelBuilder$Driver.compute2(ModelBuilder.java:246)
at hex.coxph.CoxPH$CoxPHDriver.compute2(CoxPH.java:231)
at water.H2O$H2OCountedCompleter.compute(H2O.java:1551)
at jsr166y.CountedCompleter.exec(CountedCompleter.java:468)
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: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
In addition: Warning message:
In .h2o.processResponseWarnings(res) :
Dropping bad and constant columns: [intake_type, animal_breed, intake_condition, chip_status].{quote}

we would benefit from more explicit message indicating that features (covariates) must be numeric or factors.

@exalate-issue-sync
Copy link
Author

Jan Sterba commented: added missing validation and improved the error messages

@h2o-ops
Copy link
Collaborator

h2o-ops commented May 14, 2023

JIRA Issue Migration Info

Jira Issue: PUBDEV-7492
Assignee: Jan Sterba
Reporter: Gregory Kanevsky
State: Resolved
Fix Version: 3.30.0.3
Attachments: Available (Count: 3)
Development PRs: Available

Linked PRs from JIRA

#4578

Attachments From Jira

Attachment Name: dallas_shelter_survdata_FY18-20.csv.gz
Attached By: Gregory Kanevsky
File Link:https://h2o-3-jira-github-migration.s3.amazonaws.com/PUBDEV-7492/dallas_shelter_survdata_FY18-20.csv.gz

Attachment Name: h2o_127.0.0.1_54321-3-info.log
Attached By: Gregory Kanevsky
File Link:https://h2o-3-jira-github-migration.s3.amazonaws.com/PUBDEV-7492/h2o_127.0.0.1_54321-3-info.log

Attachment Name: h2o_127.0.0.1_54321-5-error.log
Attached By: Gregory Kanevsky
File Link:https://h2o-3-jira-github-migration.s3.amazonaws.com/PUBDEV-7492/h2o_127.0.0.1_54321-5-error.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant