library(h2o)h2o.init()# import the heart datasetheart<-h2o.importFile("http://s3.amazonaws.com/h2o-public-test-data/smalldata/coxph_test/heart.csv")# split the dataset into train and validation datasetsheart.split<-h2o.splitFrame(data=heart,ratios=.8,seed=1234)train<-heart.split[[1]]test<-heart.split[[2]]# train your modelcoxph.model<-h2o.coxph(x="age",event_column="event",start_column="start",stop_column="stop",training_frame=heart,init=3)# view the model detailscoxph.modelLoadingrequirednamespace:survivalModelDetails:==============H2OCoxPHModel:coxphModelID:CoxPH_model_R_1570809926481_1Call:Surv(start,stop,event)~agecoefexp(coef)se(coef)zpage0.03071.03120.01432.150.031Likelihoodratiotest=6109on1df,p=<2e-16n=172,numberofevents=75
importh2ofromh2o.estimators.coxphimportH2OCoxProportionalHazardsEstimatorh2o.init()# import the heart datasetheart=h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/coxph_test/heart.csv")# split the dataset into train and test datasetstrain,test=heart.split_frame(ratios=[.8],seed=1234)#specify the init parameter's valueinit=3# initialize an train a CoxPH modelcoxph=H2OCoxProportionalHazardsEstimator(start_column="start",stop_column="stop",ties="breslow",init=init)coxph.train(x="age",y="event",training_frame=heart)# view the model detailscoxph.trainModelDetails=============H2OCoxProportionalHazardsEstimator:CoxProportionalHazardsModelKey:CoxPH_model_python_1570808496252_2Call:Surv(start,stop,event)~ageCoefficients:CoxPHCoefficientsnamescoefficientsexp_coefexp_neg_coefse_coefz_coef--------------------------------------------------------------age0.0306911.031170.9697750.01426862.15095Likelihoodratiotest=5.160759n=172,numberofevents=75ScoringHistory:timestampdurationiterationsloglik---------------------------------------------------2019-10-1108:59:310.000sec0-298.3262019-10-1108:59:310.001sec1-295.7992019-10-1108:59:310.002sec2-295.7452019-10-1108:59:310.004sec3-295.745<boundmethodH2OEstimator.trainof>