簡體   English   中英

libsvm輸出多標簽分類的預測概率

[英]libsvm output prediction probability for multi-label classification

我正在嘗試使用libsvm(使用Matlab接口)來運行一些多標簽分類問題。 以下是使用IRIS數據的一些玩具問題:

load fisheriris;

featuresTraining                        = [meas(1:30,:); meas(51:80,:); meas(101:130,:)];
featureSelectedTraining                 = featuresTraining(:,1:3);

groundTruthGroupTraining                = [species(1:30,:); species(51:80,:); species(101:130,:)];
[~, ~, groundTruthGroupNumTraining]     = unique(groundTruthGroupTraining);

featuresTesting                         = [meas(31:50,:); meas(81:100,:); meas(131:150,:)];
featureSelectedTesting                  = featuresTesting(:,1:3);

groundTruthGroupTesting                 = [species(31:50,:); species(81:100,:); species(131:150,:)];
[~, ~, groundTruthGroupNumTesting]      = unique(groundTruthGroupTesting);

% Train the classifier
optsStruct                              = ['-c ', num2str(2), ' -g ', num2str(4), '-b ', 1];
SVMClassifierObject                     = svmtrain(groundTruthGroupNumTraining, featureSelectedTraining, optsStruct);

optsStruct                              = ['-b ', 1];
[predLabelTesting, predictAccuracyTesting, ...
    predictScoresTesting]               = svmpredict(groundTruthGroupNumTesting, featureSelectedTesting, SVMClassifierObject, optsStruct);

但是,對於我得到的預測概率(這里顯示的前12行結果)

1.08812899093155    1.09025554950852    -0.0140009056912001
0.948911671379753   0.947899227815959   -0.0140009056926024
0.521486301840914   0.509673405799383   -0.0140009056926027
0.914684487894784   0.912534150299246   -0.0140009056926027
1.17426551505833    1.17855350325579    -0.0140009056925103
0.567801459258613   0.557077025701113   -0.0140009056926027
0.506405203427106   0.494342606399178   -0.0140009056926027
0.930191457490471   0.928343421250020   -0.0140009056926027
1.16990617214906    1.17412523596840    -0.0140009056926026
1.16558843984163    1.16986137054312    -0.0140009056926015
0.879648874624610   0.876614924593740   -0.0140009056926027
-0.151223818963057  -0.179682730685229  -0.0140009056925999

我很困惑,一些概率是如何大於1而其中一些是否定的?

但是,預測的標簽似乎非常准確:

1
1
1
1
1
1
1
1
1
1
1
3

最終輸出

Accuracy = 93.3333% (56/60) (classification)

那么如何解釋預測概率的結果呢? 非常感謝。 一種。

svm的輸出不是概率!

分數的符號表示它是屬於A類還是B類。如果分數為1或-1,則它位於邊緣,盡管知道這一點並不特別有用。

如果您確實需要概率,可以使用Platt縮放來轉換它們。 你基本上應用sigmoid函數。

我知道這個答案可能為時已晚,但它可能會讓人們遇到同樣的問題。

libsvm實際上可以產生概率,使用選項'-b'。

我認為你犯的錯誤在於你定義optsStruct變量的方式。 應該這樣定義: ['-b ' num2str(1)]['-b 1']

這同樣適用於發送到svmtrain的選項。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM