Confusion Matrix Results Issue
1 回表示 (過去 30 日間)
古いコメントを表示
I need to determine the misclassified rate of a machine learning algorithm. However, when I use the confusion function over the actual dataset and the predicted dataset (using the algorithm) the error rate is 0 whereas when I iterate through each element and compare them the error rate is 33.3%. What is wrong with the confusion matrix?
outputs = [1, 1, 1, 100, 10, 100];
predictedOutput = [1, 1, 1, 10,100, 100];
[c,cm] = confusion(outputs,predictedOutput);
fprintf('Percentage Correct Classification : %f%%\n', 100*(1-c));
counter =0;
for i = 1: size (predictedOutput,2)
if (predictedOutput(1,i) ~= outputs(1,i))
counter = counter + 1;
end
end
fprintf('Percentage Correct Classification : %f%%\n', 100*(1-(counter/(size(predictedOutput,2)))));
0 件のコメント
採用された回答
Shoaibur Rahman
2014 年 12 月 27 日
The input arguments of confusion, (in this case, outputs and predictedOutput) should be in range of [0 1]. So, instead of 100 and 10, use 1 and 0, for example.
outputs = [1, 1, 1, 1, 0, 1];
predictedOutput = [1, 1, 1, 0, 1, 1];
[c,cm] = confusion(outputs,predictedOutput);
fprintf('Percentage Correct Classification : %f%%\n', 100*(1-c));
counter =0;
for i = 1: size (predictedOutput,2)
if (predictedOutput(1,i) ~= outputs(1,i))
counter = counter + 1;
end
end
fprintf('Percentage Correct Classification : %f%%\n', 100*(1-(counter/(size(predictedOutput,2)))));
2 件のコメント
Shoaibur Rahman
2014 年 12 月 28 日
That could be one way, given it serves your purpose. Another way is to analyze the confusion matrix (user your original outputs,predictedOutput).
cmat = confusionmat(outputs,predictedOutput);
This will allow you to determine the misclassification for each group separately.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Discriminant Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!