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 Mojo Import fails for 'formula' #7409

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

CoxPH Mojo Import fails for 'formula' #7409

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

Comments

@exalate-issue-sync
Copy link

To Repro:

{code:Python}
from h2o.estimators.coxph import H2OCoxProportionalHazardsEstimator

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)

mojo_file = heart_coxph.download_mojo(path="~", get_genmodel_jar=False)

h2o.import_mojo(mojo_file)
{code}

Stacktrace

Call: 
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-6-1b205ea30ce6> in <module>
----> 1 h2o.import_mojo(mojo_file)
      2 #"/Users/nmashayekhi/Desktop/Tickets/99941 - OSS StateFarm - CoxPH/CoxPH_model_python_1626274849054_1.zip"

~/anaconda3/envs/py_36/lib/python3.6/site-packages/h2o/h2o.py in import_mojo(mojo_path)
   2251         raise TypeError("MOJO path may not be None")
   2252     mojo_estimator = H2OGenericEstimator.from_file(mojo_path)
-> 2253     print(mojo_estimator)
   2254     return mojo_estimator
   2255 

~/anaconda3/envs/py_36/lib/python3.6/site-packages/h2o/model/model_base.py in __repr__(self)
    136         stk = traceback.extract_stack()
    137         if not ("IPython" in stk[-2][0] and "info" == stk[-2][2]):
--> 138             self.show()
    139         return ""
    140 

~/anaconda3/envs/py_36/lib/python3.6/site-packages/h2o/model/model_base.py in show(self)
    537         print()
    538 
--> 539         summary = self.summary()
    540         if summary is not None:
    541             print(summary)

~/anaconda3/envs/py_36/lib/python3.6/site-packages/h2o/model/coxph.py in summary(self)
     22         """Prints summary information about this model."""
     23         print("Call: ")
---> 24         print(self.formula())
     25         print(self.coefficients_table())
     26         output = self._model_json["output"]

~/anaconda3/envs/py_36/lib/python3.6/site-packages/h2o/model/coxph.py in formula(self)
      9     def formula(self):
     10         """Survival formula."""
---> 11         return self._model_json["output"]["formula"]
     12 
     13     def concordance(self):

KeyError: 'formula'

@h2o-ops
Copy link
Collaborator

h2o-ops commented May 14, 2023

JIRA Issue Details

Jira Issue: PUBDEV-8244
Assignee: Michal Kurka
Reporter: Neema Mashayekhi
State: Resolved
Fix Version: 3.32.1.5
Attachments: N/A
Development PRs: Available

@h2o-ops
Copy link
Collaborator

h2o-ops commented May 14, 2023

Linked PRs from JIRA

#5580

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