This code is designed for two or more classes instance confusion matrix formation and Calclating
3.Sensitivity (Recall or True positive rate)
6.FPR-False positive rate
8.MCC-Matthews correlation coefficient
Run demo.m for proof and demo
Developer Er.Abbas Manthiri S
Mail Id: firstname.lastname@example.org
Coding is based on attached reference
Abbas Manthiri S (2020). Multi Class Confusion Matrix (https://www.mathworks.com/matlabcentral/fileexchange/60900-multi-class-confusion-matrix), MATLAB Central File Exchange. Retrieved .
Please,Can you update the codec for multiclass .
Thank you Richa and Li Yew! You helped me a lot with the code corrections!
Thank you for the code. I ask you one question why AccuracyOfSingle equal with sensitivity in the result of Multi-Class??
This is a mistake, right?
Thank you for developing such a useful tool.
for those faces same issue with me...As my input data is in categorical format, so i change the num2str(class_list(i)) to char(class_list(i)), then everything is fine.
Hi, Can anyone please help to clarify what does the "Error" signifies here. Is it EER (Equal Error Rate)?
This is awesome, thanks Abbas
Wander full, Save lots of time to compute each stat, Thank you
To make this work for mutliclass in case Class List is not same .. i commented the error condition "error('Class List is not same in given inputs')" and "error('Class List in given inputs are different')". Also, tweaked the code on line 81 as
if length(un_actual) >= length(un_predict)
I get error as "Class List is not same in given inputs" while running it on my data. Please help
When i call classify() it returns the Predicted_labels in "categorical" format, whivh while passing it to geMatrix gives an error that it does not support catgorical values. How to resolve this
i got the results for Precision and recall but the graph i am plotting is not giving the desired plot what to do now.?? what mistake i am making anyone please help.
This is a useful submission. It would be great if the class name was different, as it overloads the MATLAB confusion function:
Thanks Abbas, great code, saved me quite some time!
I update the file
Thanks for feedback
i put mistake please change
i will update that code
thank for giving feed back
Thank you abbas for making corrections.Excellent contribution from your side.
If you want to improve it more.Make this code capable for dealing with multi-class with binary (0,1) values only
having multiple rows/col.Just like this example.https://www.mathworks.com/help/nnet/examples/wine-classification.html.Your code gives error on this example dataset.This code only deals with single rows and single col as input/output.
@Machine Learning Enthusiast
Thanks for feed back
@Machine Learning Enthusiast
I Checked my coding for you
i calculate the single class accuracy rate so change the formula
to in line 192
And formula available only to calculate Accuracy for two class only
we dont have formula for single class accuracy over multiclass
thanks for your feedback
Secondly can you please check.It calculates the True Negative correctly?.In my case it calculates wrong
excellent code.I am dealing with 3 class problem.I have just one question in codeline 192, when calculating the accuracy for each class. It gives the wrong accuracy for each class?.Any insight on this from your side will be greatly appreciated.
@Carlos Lopez Vydrin because multi-class confusion matrix changes formula compare to two class confusion matrix
Thank you for this wonderful code. I have just one question in codeline 192, when calculating the accuracy for each class. Why have you put an "Case/otherwise"-statement and why is the "accuracy"-calculations different in codeline 192 and 187?
@ Kh. Islam Thank you
Thank you for your efforts.
small typo changed
publish view improved
Coding converted to class method
Clear Publish view
extra datum given to output