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

1 次查看(过去 30 天)
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

回答(1 个)

Puru Kathuria
Puru Kathuria 2020-3-11
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:

类别

Help CenterFile Exchange 中查找有关 Parallel Computing 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by