MATLAB Answers

How to calculate confusion matrix , accuracy and precision

조회 수: 148(최근 30일)
Abdussalam Elhanashi
Abdussalam Elhanashi 10 Dec 2020
Hi
I have two logical tables 100 x 100 for each that contain 0 & 1 values . one table for original values and other table is for predicted values
i want to know how can i make confusion matrix and calculate accuracy and precision for predicted values in comparision to original values
Here the tables:-
original values
predicted values

답변(1개)

Srivardhan Gadila
Srivardhan Gadila 17 Dec 2020
You can refer to the following functions available in MATLAB to compute confusion matrix: Functions for computing "confusion matrix".
accuracy = sum(OrigValues == PredValues,'all')/numel(PredValues)
Make sure that the above computations are performed properly w.r.t the number of samples dimension and necessary changes are to be made based on it (i.e., Dimension of number of samples can be number of rows or number of columns or the number of tables itself in your case as it is not mentioned anywhere in the question).

Community Treasure Hunt

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

Start Hunting!

Translated by