How do I include errorbar on my F1 score plot
조회 수: 5 (최근 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!