- https://in.mathworks.com/matlabcentral/answers/348606-how-to-extract-true-positive-and-true-negative-rates-from-confusion-matrix-obtained-using-classifica?s_tid=answers_rc1-1_p1_Topic
- https://in.mathworks.com/matlabcentral/answers/492598-matlab-pca-lda-code?s_tid=answers_rc1-2_p2_MLT
- https://in.mathworks.com/matlabcentral/answers/325791-what-is-the-value-of-predicted-and-actual
How to create a confusion matrix?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I am trying to use the example from mathworks, identifying significant features and classifying protein profiles, to create a confusion matrix. I am having difficulties identifying what the true values and predicted would be when looking at the PCA-LDA. Can someone help me identify them?
Link below:
https://www.mathworks.com/help/bioinfo/ug/identifying-significant-features-and-classifying-protein-profiles.html#d122e20387
0 Kommentare
Antworten (1)
Pankhuri Kasliwal
am 8 Okt. 2020
Hi,
This can be done using the "plotconfusion" function. By default, this command will also plot the True Positive, False Negative, Positive Predictive, and False Discovery rates in they grey-colored boxes. Please refer to the following example:
targetsVector = [1 2 1 1 3 2]; % True classes
outputsVector = [1 3 1 2 3 1]; % Predicted classes
% Convert this data to a [numClasses x 6] matrix
targets = zeros(3,6);
outputs = zeros(3,6);
targetsIdx = sub2ind(size(targets), targetsVector, 1:6);
outputsIdx = sub2ind(size(outputs), outputsVector, 1:6);
targets(targetsIdx) = 1;
outputs(outputsIdx) = 1;
% Plot the confusion matrix for a 3-class problem
plotconfusion(targets,outputs)
The class labels can be customized by setting that 'XTickLabel' and 'YTickLabel' properties of the axis:
h = gca;
h.XTickLabel = {'Class A','Class B','Class C',''};
h.YTickLabel = {'Class A','Class B','Class C',''};
h.YTickLabelRotation = 90;
To know more about true values and predicted values, refer to the following links -
0 Kommentare
Siehe auch
Kategorien
Mehr zu Dimensionality Reduction and Feature Extraction finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!