LSSVM LAB Performance Metrics

조회 수: 15 (최근 30일)
maryam hatami
maryam hatami 2021년 6월 30일
편집: Amr Embaby 2023년 8월 26일
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