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

Add to docs examples of getting baseline hazard, baseline survival, corcordance #7558

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

Comments

@exalate-issue-sync
Copy link

Currently in docs:

{code:python}import h2o
from h2o.estimators.coxph import H2OCoxProportionalHazardsEstimator
h2o.init()

Import the heart dataset into H2O:

heart = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/coxph_test/heart.csv")

Split the dataset into a train and test set:

train, test = heart.split_frame(ratios = [.8], seed = 1234)

Build and train the model:

heart_coxph = H2OCoxProportionalHazardsEstimator(start_column="start",
stop_column="stop",
ties="breslow")
heart_coxph.train(x="age",
y="event",
training_frame=train)

Generate predictions on a test set (if necessary):

pred = heart_coxph.predict(test){code}

ADD a few more lines to get other properties from CoxPH

{code:python}# Get baseline hazard
h2o.baseline_hazard_frame

Get baseline survival

h2o.baseline_survival_frame

Get model concordance

heart_coxph.model_performance().concordance(){code}

@exalate-issue-sync
Copy link
Author

Michal Kurka commented: [~accountid:5d1185d4f46aa30c271c7cc6] improvements were made and Jira description updated

cc: [~accountid:5dc4f5bbb6e6b50c58af0624]

@h2o-ops
Copy link
Collaborator

h2o-ops commented May 14, 2023

JIRA Issue Details

Jira Issue: PUBDEV-8091
Assignee: hannah.tillman
Reporter: Neema Mashayekhi
State: Resolved
Fix Version: 3.32.1.3
Attachments: N/A
Development PRs: Available

@h2o-ops
Copy link
Collaborator

h2o-ops commented May 14, 2023

Linked PRs from JIRA

#5424
#5430

@h2o-ops h2o-ops closed this as completed May 14, 2023
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

2 participants