|
|
|
import h2o |
|
|
|
|
|
h2o.__version__ |
|
|
|
|
|
h2o.init() |
|
|
|
|
|
from h2o.estimators import H2OGradientBoostingEstimator |
|
h2o.init(jvm_custom_args=["sys.ai.h2o.debug.allowJavaVersions", "18"]) |
|
|
|
|
|
prostate = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/prostate/prostate.csv") |
|
|
|
|
|
prostate["CAPSULE"] = prostate["CAPSULE"].asfactor() |
|
predictors = ["ID","AGE","RACE","DPROS","DCAPS","PSA","VOL","GLEASON"] |
|
response = "CAPSULE" |
|
|
|
|
|
pros_gbm = H2OGradientBoostingEstimator(nfolds=5, |
|
seed=1111, |
|
keep_cross_validation_predictions = True) |
|
pros_gbm.train(x=predictors, y=response, training_frame=prostate) |
|
|
|
|
|
perf = pros_gbm.model_performance() |
|
|
|
|
|
pred = pros_gbm.predict(prostate) |
|
|
|
|
|
feature_interactions = pros_gbm.feature_interaction() |
|
|
|
|
|
feature_interactions |
|
|
|
|
|
|
|
h2o.save_model(model=pros_gbm, force=True) |
|
|
|
|
|
pros_gbm.save_mojo('mojo') |
|
|
|
|
|
|