2017-08-12 44 views
1

当试图使用例如获取召回得分时,h2o ValueError:No metric tpr

rf_model.recall() 

我得到的错误:

h2o ValueError: No metric tpr 

我能得到其他指标,如准确性,AUC,精度和F1,但没有召回... 这可能是一个错误。

如果我运行:

from h2o.model.metrics_base import H2OBinomialModelMetrics as bmm 
reporter = bmm(rf_model.metric) 
rf_model.metric('recall') 

我得到:

Could not find exact threshold 0.0; using closest threshold found 0.0. 

这是怎么回事?

我正在运行h2o版本'h2o-3.15.0.3990'。

我跟着H2O教程:

https://github.com/h2oai/h2o-tutorials/blob/master/training/h2o_algos/src/py/decision_tree_ensembles.ipynb

,并用自己的数据集,我得到上述错误。

任何帮助?

此外,如何使用h2o绘制精度/回忆曲线?

感谢

+0

请不要与邮件列表交叉发布。(StackOverflow对于这类问题来说是更好的选择。) –

回答

1

你第二个问题开始,流量有精度/召回曲线(它是互动)。流程始终在每个节点的端口54321上运行,如果您在本地运行h2o,则流程为http://127.0.0.1:54321

我想你的数据或模型有一些有趣的地方,当你看到精度/回忆曲线时,它将变得清晰。

在R如果你这样做str(m)(其中m是你的型号),你会看到所有的模型数据。 [email protected][email protected]$thresholds_and_metric_scores$recall保存每个阈值的召回号码。

我无法弄清楚如何查看Python对象,但是你的调用是正确的。在我的快速测试(有2类ENUM列虹膜数据集添加):

m.metric("recall") 

了:

[[0.8160852636726422, 1.0]] 

如果我想所有的值,这将是这样的:

mDL.metric("recall",thresholds=[x/100.0 for x in range(1,100)]) 

,并提供:

Could not find exact threshold 0.01; using closest threshold found 0.010396965719556233. 
Could not find exact threshold 0.02; using closest threshold found 0.016617060110009896. 
... 
Could not find exact threshold 0.92; using closest threshold found 0.9469528904679438. 
Could not find exact threshold 0.93; using closest threshold found 0.9469528904679438. 
Could not find exact threshold 0.94; using closest threshold found 0.9469528904679438. 
Could not find exact threshold 0.95; using closest threshold found 0.9469528904679438. 
Could not find exact threshold 0.96; using closest threshold found 0.9469528904679438. 
Could not find exact threshold 0.97; using closest threshold found 0.9760293572153097. 
Could not find exact threshold 0.98; using closest threshold found 0.9787491606489236. 
Could not find exact threshold 0.99; using closest threshold found 0.9909817370067531. 

[[0.01, 1.0], 
[0.02, 1.0], 
[0.03, 1.0], 
... 
[0.87, 1.0], 
[0.88, 1.0], 
[0.89, 0.9850746268656716], 
[0.9, 0.9850746268656716], 
[0.91, 0.9850746268656716], 
[0.92, 0.9850746268656716], 
[0.93, 0.9850746268656716], 
[0.94, 0.9850746268656716], 
[0.95, 0.9850746268656716], 
[0.96, 0.9850746268656716], 
[0.97, 0.9701492537313433], 
[0.98, 0.9552238805970149], 
[0.99, 0.8955223880597015]] 

(我得到如此不寻常的输出,因为它学到了我的数据集几乎完美 - 我怀疑这是发生在你身上?)(我愚蠢地让我的二进制列成为输入列之一的直接函数,没有噪声!)