Confusion Matrix Results Issue
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Mr X
le 27 Déc 2014
Commenté : Shoaibur Rahman
le 28 Déc 2014
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 commentaires
Réponse acceptée
Shoaibur Rahman
le 27 Déc 2014
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 commentaires
Shoaibur Rahman
le 28 Déc 2014
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.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Discriminant Analysis dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!