mlee_jordan
mlee_jordan

Reputation: 842

Calibrated probabilities from mojo object

I have a model developed with h2o 3.38. I calibrated it with a separate data. Now when I score a new data set, I see the calibrated probabilities. If I save the model as:

h2o.save_model(gbm_model, path=model_path', force=True) and load it with h2o.load_model(model_path) and score it I can get calibrated probabilities.

However, if I use mojo as: gbm.save_mojo(model_path) and load it as h2o.import_mojo(model_path) and score the data I don't get calibrated probabilities.

Is it not possible to get calibrated probabilities with mojo?

Upvotes: 0

Views: 67

Answers (1)

Wendy
Wendy

Reputation: 301

I have looked at your problem for GBM for Bernoulli distribution. I used save_mojo and import_mojo and checkout the predicted result. If you lookt at the predicted result, it contains one column only. It is the probability of the class belonging to class 1. Hence, if you want the probability of class 0, you can do a 1-predicted result.

Here is the code I used:

fr = h2o.import_file("https://s3.amazonaws.com/h2o-public-test-data/smalldata/prostate/prostate.csv")

model = H2OGradientBoostingEstimator(ntrees=10, seed=1234)
model.train(x=list(range(2, fr.ncol)), y=1, training_frame=fr)

# Default filename is model_id
mojo_path = model.save_mojo()
mojo_model = h2o.import_mojo(mojo_path)
predictFrame = mojo_model.predict(fr)
print(predictFrame[0,0])

Upvotes: 0

Related Questions