LSSVM LAB Performance Metrics

6 views (last 30 days)
maryam hatami
maryam hatami on 30 Jun 2021
Edited: Amr Embaby on 26 Aug 2023
Hello,
I am using LSSVMLAB to implement Least Square Support Vector Machine Algorithm.
I need to determine the accuracy, FPR, FNR, and other performance metrics results. How can I find them?
This is a code, getting some performance metrics, but it gets more than 1 value for each! It gives the result for each threshold.(For example, for 100 thresholds in ROC, it gets 100 TP results)
[area, se, thresholds, oneMinusSpec, sens, TN, TP, FN, FP] = roc(Y_latent,Y);

Accepted Answer

maryam hatami
maryam hatami on 3 Jul 2021
I found the answer. All metrics are evaluated from TP, FP, TN, FN getting from the data:
len =length(Yt);
TP = 0;
FP = 0;
TN = 0;
FN = 0;
for i=1:len
if Yt(i)==Yvalid(i)==1
TP=TP+1;
end
if (Yvalid(i)==1) && (Yt(i)~=Yvalid(i))
FP=FP+1;
end
if (Yt(i)==Yvalid(i)==0)
TN=TN+1;
end
if (Yvalid(i)==0) && (Yt(i)~=Yvalid(i))
FN=FN+1;
end
end
TN
FP
FN
TP
fprintf(1,'Precision: %2.2f\n',100*sum(TP)/(TP+FP));
fprintf(1,'Recall: %2.2f\n',100*sum(TP)/(TP+FN));
fprintf(1,'F1_Score: %2.2f\n',2*(prc*recall)/(prc+recall));
fprintf(1,' FPR: %2.2f\n',100*(FP)/(TN+FP));
fprintf(1,' FNR: %2.2f\n',100*(FN)/(TP+FN));
fprintf(1,' TNR: %2.2f\n',100*(TN)/(TN+FP));
fprintf(1,'Accuracy: %2.2f\n',100*(TP+TN)/(TN+TP+FN+FP));
  1 Comment
Amr Embaby
Amr Embaby on 26 Aug 2023
Edited: Amr Embaby on 26 Aug 2023
i'm trying to use robustLssvm function but i get that error :
SWITCH expression must be a scalar or a character vector.
Error in weightingscheme (line 9)
switch wfct Error in Roboustlssvm (line 74)
w = weightingscheme(casses,model.weights,delta);
do you know how to solve it?
my code:
type = 'function estimation';
[Yp,alpha,b,gam,sig2,model] = lssvm(fts_tle_si_x_wz_2_tra_nrm_mtx,tgs_tle_si_x_wz_2_tra.b,type);
model = tunelssvm(model, 'gridsearch','leaveoneoutlssvm', {'mse'});
model = robustlssvm(model);

Sign in to comment.

More Answers (0)

Categories

Find more on MATLAB 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!