What happen with confusion matrix ?

3 ビュー (過去 30 日間)
Oman Wisni
Oman Wisni 2019 年 2 月 21 日
コメント済み: Oman Wisni 2019 年 2 月 22 日
Hi, Im trying to create confusion matrix, but the result in the green color or true class is not 100%, if the range 1-10 it should be 10,0% but I get 9,1%. please help me if I wrong? or explain why the result like this ?
here the code and result :
targetsVector = ttes.'; % True classes
outputsVector = pred_tes.'; % Predicted classes
% Convert this data to a [numClasses x 55] matrix
targets = zeros(11,55);
outputs = zeros(11,55);
targetsIdx = sub2ind(size(targets), targetsVector, 1:55);
outputsIdx = sub2ind(size(outputs), outputsVector, 1:55);
targets(targetsIdx) = 1;
outputs(outputsIdx) = 1;
plotconfusion(targets,outputs)

採用された回答

the cyclist
the cyclist 2019 年 2 月 22 日
It looks like you have 55 observations. 51 of them were classified correctly (along the diagonal, indicated in green). But 4 of them were misclassified -- two observations with target class 1, but were in output class 7 and two observations with target class 7, but where in output class 5.
Classifiers are not usually perfect, so misclassifications happen. Did you expect your classifier to be perfect? Why?
  1 件のコメント
Oman Wisni
Oman Wisni 2019 年 2 月 22 日
編集済み: Oman Wisni 2019 年 2 月 22 日
No, Im not need my classifier to be perfect. Yes I understand what the meaning of along the diagonal indicate in green. Just like anwer Mr Kevin Chng, can more specific explain. For exampel at the second row and second column, the value is 5 and the percentage is 9,1%, why it 9,1 % why not 100%. how to calculate it? can you give a simple example to get 9.1% results? why not 10.0%
Thank you

サインインしてコメントする。

その他の回答 (1 件)

Kevin Chng
Kevin Chng 2019 年 2 月 22 日
編集済み: Kevin Chng 2019 年 2 月 22 日
Your Question:
The result in the green color or true class is not 100%, if the range 1-10 it should be 10,0% but I get 9,1%.
You may find the detail of plotconfusion as below:
In the documentation, it stated :
The diagonal cells correspond to observations that are correctly classified. The off-diagonal cells correspond to incorrectly classified observations. Both the number of observations and the percentage of the total number of observations are shown in each cell.
for example, at the first row and first column, the value is 3 and the percentage is 5.5%.
It means that there are 3 predicted observation classified as Class1, the percentage of 3 of all the observation is 5.5%.
  3 件のコメント
Kevin Chng
Kevin Chng 2019 年 2 月 22 日
編集済み: Kevin Chng 2019 年 2 月 22 日
Yup, you are right,
3/55 = 5.5% means for the first row and first column.
About your question:
in this link the example result 10,0% but why my result 9,1% ?
The example is not your example. In the exmple,
There are 5000 observation in total, at the first row and first column,
The predicted observation in this class is 499, so that
499/5000 = 10%
but why my result 9,1% ?
In your matrix, at second row and second column, the predicted observation in this class is 5.
5/55 = 9.1%
Accept my answer if it help you.
Oman Wisni
Oman Wisni 2019 年 2 月 22 日
Ok thank you sir. It very help. Thank sir. Ok already I accept your answer

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeClassification についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by