LSSVM LAB Performance Metrics

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

采纳的回答

maryam hatami
maryam hatami 2021-7-3
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 个评论
Amr Embaby
Amr Embaby 2023-8-26
编辑:Amr Embaby 2023-8-26
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);

请先登录,再进行评论。

更多回答(0 个)

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by