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

9 vues (au cours des 30 derniers jours)
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

Réponses (1)

Puru Kathuria
Puru Kathuria le 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:

Catégories

En savoir plus sur Statistics and Machine Learning Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by