【问题标题】:What do the two numbers for accuracy, precision, F1, etc. mean?准确度、精度、F1 等这两个数字是什么意思?
【发布时间】:2017-08-01 00:12:02
【问题描述】:

我的随机森林模型代码的结尾是:

print('\nModel performance:')
performance = best_nn.model_performance(test_data = test)
accuracy  = performance.accuracy()
precision = performance.precision()
F1        = performance.F1()
auc       = performance.auc()
print('  accuracy.................', accuracy)
print('  precision................', precision)
print('  F1.......................', F1)
print('  auc......................', auc)

这段代码产生以下输出:

Model performance:
  accuracy................. [[0.6622929108639558, 0.9078947368421053]]
  precision................ [[0.6622929108639558, 1.0]]
  F1....................... [[0.304835115538703, 0.5853658536585366]]
  auc...................... 0.9103448275862068

为什么我得到两个准确度、精度和 F1 的数字,它们是什么意思?

查尔斯

PS:我的环境是:

H2O cluster uptime:         6 mins 02 secs
H2O cluster version:        3.10.4.8
H2O cluster version age:    2 months and 9 days
H2O cluster name:           H2O_from_python_Charles_wdmhb7
H2O cluster total nodes:    1
H2O cluster free memory:    21.31 Gb
H2O cluster total cores:    8
H2O cluster allowed cores:  4
H2O cluster status:         locked, healthy
H2O connection url:         http://localhost:54321
H2O connection proxy:
H2O internal security:      False
Python version:             3.6.2 final

【问题讨论】:

  • 也许它们对于训练和测试数据都是准确的。精度和 f1 相同。但我不确定。

标签: python-3.x h2o


【解决方案1】:

这两个数字分别是该指标的阈值和值。一旦确定了阈值,就可以计算 accuracyprecision 指标。

如果您使用model.confusion_matrix(),您可以看到使用的阈值。

例如,在二元分类中,“阈值”是确定预测类别标签的值(介于 0 和 1 之间)。如果您的模型预测特定测试用例的值为 0.2,并且您的阈值为 0.4,则预测的类标签将为 0。如果您的阈值为 0.15,则预测的类标签将为 1。

【讨论】:

    猜你喜欢
    • 2014-03-10
    • 1970-01-01
    • 1970-01-01
    • 2020-04-16
    • 2021-05-02
    • 1970-01-01
    • 1970-01-01
    • 2019-06-06
    • 1970-01-01
    相关资源
    最近更新 更多