0

这是我第一次在 OpenCV 中使用机器学习功能。我使用了 Boost 算法,我认为它效果很好。calc_error然而,这个函数只给出错误,没有错误类型,这很烦人。我的意思是:

第一类误报、误报

或者

类型 II 缺少目标

OpenCV 也可以给出错误类型吗?太感谢了。

4

1 回答 1

0

在您的测试实例上使用predict,循环所有测试实例并将结果与​​真实类进行比较,以自己查找类型 1/类型 2 错误(或精度和准确性,在机器学习中更常见的相关概念)。

表达这个想法的一些伪代码:

true_positive = 0
false_positive = 0
true_negative = 0
false_negative = 0

For i in 1..N:
    test_instance = test_set[i]

    true_class = labels[i]
    predicted_class = predict(test_instance, ... )

    if true_class = True and predicted_class == True
        true_positive += 1
    elseif true_class == False and predicted_class == True
        false_positive += 1
    elseif true_class == True and predicted_class == False
        false_negative += 1
    elseif true_class == False and predicted_class == False
        true_negative += 1
    end

type_I_error = false_positive/N
type_II_error = false_negative/N
于 2013-03-27T11:22:56.470 回答