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

9 Ansichten (letzte 30 Tage)
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

Antworten (1)

Puru Kathuria
Puru Kathuria am 11 Mär. 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:

Kategorien

Mehr zu Statistics and Machine Learning Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by