I have built a random-forest model with h2o. I am trying to plot it with h2otree. I am getting a TypeError: 'NoneType' object is not iterable
I can replicate the error. The class H2OTree calls a function __decode_categoricals(model, response['levels'])
which iterates over reponse levels of type None.
from h2o.tree import H2OTree
first_tree = H2OTree(model = rf_model, tree_number = 0, tree_class = target_class_category)
#error replication
params = {"model": model.model_id,
"tree_number": 0,
"tree_class": target_class_category}
response = h2o.api(endpoint="GET /3/Tree", data=params)
for lvl_index in response['levels']:
if len(lvl_index) >0: #error, 'NoneType' has no len()
print('yes')