How do I include errorbar on my F1 score plot
2 次查看(过去 30 天)
显示 更早的评论
I want to include the errorbar on my F1 score plot. I don't know how to go about it. Here is my code below
% Given data
p = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
TPR_PCA = [79.4, 80.25, 83, 90.50, 91.31, 91.34, 91.34, 91.35, 91.35, 91.35] / 100;
TPR_kPCA = [80.50, 81.70, 85.85, 92.25, 92.40, 92.45, 92.44, 92.48, 92.50, 92.50] / 100;
PREC_PCA = [71.05, 72.50, 76.70, 86.00, 86.20, 86.20, 86.25, 86.27, 86.27, 86.28] / 100;
PREC_kPCA = [72.20, 73.00, 78.95, 88.40, 88.56, 88.56, 88.56, 88.56, 88.56, 88.56] / 100;
% Compute F1 scores for PCA-HMM and kPCA-HMM
F1_PCA = 2 * (TPR_PCA .* PREC_PCA) ./ (TPR_PCA + PREC_PCA);
F1_kPCA = 2 * (TPR_kPCA .* PREC_kPCA) ./ (TPR_kPCA + PREC_kPCA);
figure;
subplot(1,2,1) %SRW
plot(p, F1_PCA, 'kx-', 'MarkerSize', 8, 'DisplayName', 'SRW:PCA-HMM');
hold on;
plot(p, F1_kPCA, 'mo-', 'MarkerSize', 5, 'DisplayName', 'SRW:kPCA-HMM');
hold off;
xlabel('p');
ylabel('F1 Score');
title('\textbf{(a) F1 score @ $\mathcal{W}$=128}', 'Interpreter','latex');
legend('Location', 'southeast');
grid minor;
0 个评论
回答(1 个)
Dyuman Joshi
2023-8-29
% Given data
p = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
TPR_PCA = [79.4, 80.25, 83, 90.50, 91.31, 91.34, 91.34, 91.35, 91.35, 91.35] / 100;
TPR_kPCA = [80.50, 81.70, 85.85, 92.25, 92.40, 92.45, 92.44, 92.48, 92.50, 92.50] / 100;
PREC_PCA = [71.05, 72.50, 76.70, 86.00, 86.20, 86.20, 86.25, 86.27, 86.27, 86.28] / 100;
PREC_kPCA = [72.20, 73.00, 78.95, 88.40, 88.56, 88.56, 88.56, 88.56, 88.56, 88.56] / 100;
% Compute F1 scores for PCA-HMM and kPCA-HMM
F1_PCA = 2 * (TPR_PCA .* PREC_PCA) ./ (TPR_PCA + PREC_PCA);
F1_kPCA = 2 * (TPR_kPCA .* PREC_kPCA) ./ (TPR_kPCA + PREC_kPCA);
%Size of the error bar you want
err = 0.005*ones(size(p));
figure;
errorbar(p, F1_PCA, err, 'kx-', 'MarkerSize', 8, 'DisplayName', 'SRW:PCA-HMM');
hold on;
errorbar(p, F1_kPCA, err, 'mo-', 'MarkerSize', 5, 'DisplayName', 'SRW:kPCA-HMM');
hold off;
xlabel('p');
ylabel('F1 Score');
title('\textbf{(a) F1 score @ $\mathcal{W}$=128}', 'Interpreter','latex');
legend('Location', 'southeast');
grid minor;
xlim([2 13])
3 个评论
Dyuman Joshi
2023-8-29
I don't understand.
Could you please show an example or specify more about what you want to obtain?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Distribution Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!