Clear Filters
Clear Filters

How to get accuracy rate, error rate, precission, recall and kappa for fitglm model?

6 views (last 30 days)
I Have sintax for GLM Model, and I already get the grafik predicition.
x = [data.a,data.b, data.c];
y = data.d;
disp('model')
model = fitglm(x,y,'linear');
disp(model);
prediction = predict(model,x);
How can i get accuracy rate, error rate, precission, recall and kappa for the accuration prediction?
Thanks

Answers (1)

Puru Kathuria
Puru Kathuria on 11 Mar 2020
Hi,
I understand that you want to compute the following metrics to evaluate your model. I hope the following explaination helps you in doing so.
Assume the following notations:
C: represent number of classes
: true positives
: false negatives
: True negatives
: False positives
N: total number of test samples
Also, the following is explained for C = 2 , it can be generalized for any value of C.
[ConfusionMat,order] = confusionmat(Y,prediction); % Will return the CxC classes
After you have the confusion matrix, you can compute the following metrics using given formulas:
For your problem, compute Kappa as the following:

Categories

Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!