Confusion Matrix Results Issue
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Mr X
il 27 Dic 2014
Commentato: Shoaibur Rahman
il 28 Dic 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 Commenti
Risposta accettata
Shoaibur Rahman
il 27 Dic 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 Commenti
Shoaibur Rahman
il 28 Dic 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.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Discriminant Analysis in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!