How do I include errorbar on my F1 score plot

2 visualizaciones (últimos 30 días)
Cutie
Cutie el 29 de Ag. de 2023
Editada: Cutie el 30 de Ag. de 2023
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;

Respuestas (1)

Dyuman Joshi
Dyuman Joshi el 29 de Ag. de 2023
Use errorbar -
% 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 comentarios
Dyuman Joshi
Dyuman Joshi el 29 de Ag. de 2023
I don't understand.
Could you please show an example or specify more about what you want to obtain?
Cutie
Cutie el 29 de Ag. de 2023
Editada: Cutie el 30 de Ag. de 2023
Thank you again @Dyuman Joshi
I have developed two models, PCA-HMM and kPCA-HMM. I have computed the F1 score for the two models on the same plot. Now, I want to use the error bar to evaluate conficen interval (or assess the level of confidence) in my results and how the error bars can be used to gain more insight about the results.

Iniciar sesión para comentar.

Categorías

Más información sobre Histograms en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by