2013-03-27 45 views
0

這是我第一次在OpenCV中使用機器學習函數。我使用Boost算法,我認爲它運作良好。然而,它很煩人,功能calc_error只給出錯誤,沒有錯誤類型。我的意思是:OpenCV機器學習輸出類型I和類型II錯誤

I型假陽性錯誤,誤報

II型缺少目標

燦OpenCV中也給出了錯誤類型?非常感謝。

回答

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