可视化 h2o 随机森林模型树时出现类型错误
Type error when visualising h2o random-forest model tree
我用 h2o 建立了一个随机森林模型。我正在尝试用 h2otree 绘制它。我得到一个 TypeError: 'NoneType' object is not iterable
我可以复制错误。 class H2OTree 调用函数 __decode_categoricals(model, response['levels'])
迭代 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')
如果您想可视化 H2O 树,您可以使用 Mojo Visualizer(文档 here)或查看之前的 questions/posts:
Visualizing H2O GBM and Random Forest MOJO Models Trees in Python
我用 h2o 建立了一个随机森林模型。我正在尝试用 h2otree 绘制它。我得到一个 TypeError: 'NoneType' object is not iterable
我可以复制错误。 class H2OTree 调用函数 __decode_categoricals(model, response['levels'])
迭代 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')
如果您想可视化 H2O 树,您可以使用 Mojo Visualizer(文档 here)或查看之前的 questions/posts:
Visualizing H2O GBM and Random Forest MOJO Models Trees in Python