How to check H2O Automl leader model detail (parameter) in python ?

199 views
Skip to first unread message

CJh

unread,
Jun 5, 2018, 11:36:34 AM6/5/18
to H2O Open Source Scalable Machine Learning - h2ostream
In python , after finishing H2o Automl, can I check the detail of the leader model ?
(e.g. leader model is DRF , I want to know the ntrees=? , max_depth=? , ... and so on)

Erin LeDell

unread,
Jun 11, 2018, 9:44:54 PM6/11/18
to CJh, H2O Open Source Scalable Machine Learning - h2ostream

You can grab the params like you grab the params of any model (it's in .params).  The model is stored at aml.leader.  See example:

import h2o
from h2o.automl import H2OAutoML

h2o.init()

# Import a sample binary outcome training set into H2O
train = h2o.import_file("https://s3.amazonaws.com/erin-data/higgs/higgs_train_10k.csv")

# Identify predictors and response
x = train.columns
y = "response"
x.remove(y)

# For binary classification, response should be a factor
train[y] = train[y].asfactor()

# Run AutoML for 30 seconds
aml = H2OAutoML(max_runtime_secs = 30)
aml.train(x = x, y = y,
          training_frame = train)

# View the AutoML Leaderboard
lb = aml.leaderboard
lb

# Look at leader model params (probably a stacked ensemble)
aml.leader.params

# Look at a random model (let's say #4 on the leaderboard)
model = h2o.get_model(lb[3,'model_id']) #get model by model_id
model.params
Reply all
Reply to author
Forward
0 new messages