h2o hit_ratio_table 属性错误

h2o hit_ratio_table AttributeError

我正在学习来自 https://github.com/h2oai/h2o-tutorials/blob/master/tutorials/gbm-randomforest/GBM_RandomForest_Example.py

的教程

我一直在学习教程,直到到达 hit_ratio_table 行。当我执行 "rf_v1.hit_ratio_table(valid=True)",我遇到了下面的错误。

>>> rf_v1.hit_ratio_table(valid=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/h2oUser/sparkling-water-2.3.0/py/build/dist/h2o_pysparkling_2.3-2.3.0.zip/h2o/utils/backward_compatibility.py", line 74, in __getattr__
  File "/home/h2oUser/sparkling-water-2.3.0/py/build/dist/h2o_pysparkling_2.3-2.3.0.zip/h2o/utils/backward_compatibility.py", line 49, in __getattribute__
AttributeError: type object 'H2ORandomForestEstimator' has no attribute 'hit_ratio_table'

我试图搜索 hit_ratio_table 是否被弃用,但我找不到任何链接。有谁知道此功能是否已更改?

该属性仍然存在,看起来教程在文件导入后缺少一行代码,这意味着该模型被视为回归问题而不是分类问题。因此,如果您在导入 covtype 数据集后添加以下行:

covtype_df[54] = covtype_df[54].asfactor()

将目标转换为因子,应该可以。

如果您想尝试一下 hit_ratio_table(),可以查看 H2O-3 用户指南中的 code snippet