sklearn函数中计算的平均精度分数遵循下图所示的公式。
AP = Σ(Rn - Rn-1)Pn *The index value of the sumation is n. Please refer to the attached image for a clear version of the formula
我正在努力完全理解这个函数背后的数学原理。我特别好奇公式中的第n个阈值是如何计算的。阈值的数量是否等于样本的数量?
我有逻辑回归模式,其中我显式地将阈值设置为0.5。
model.setThreshold(0.5)
我训练模型,然后我想获得基本的统计数据--精度、召回率等。
这是我在评估模型时所做的:
val metrics = new BinaryClassificationMetrics(predictionAndLabels)
val precision = metrics.precisionByThreshold
precision.foreach { case (t, p) =>
println(s"Threshold is: $t, Precision is:
当试图获得回忆的分数时,使用。
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