LSSVM LAB Performance Metrics

6 ビュー (過去 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 Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by