Code covered by the BSD License
 acc_cmp1(targs,preds1,pre...Tests the null hypothesis that two classifiers that were tested on
 acc_cmp2(C1,C2)Tests the null hypothesis that two classifiers that were tested on
 acc_mean(C)Expected value of the accuracy (i.e., the mean of a Beta distribution).
 acc_med(C)Median of the accuracy (i.e., the median of a Beta distribution).
 acc_mode(C)Most likely accuracy (i.e., the mode of a Beta distribution)
 acc_p(C)P value of the Null hypothesis that the accuracy is not significantly
 acc_ppi(C,alpha)Posterior probability interval of the accuracy.
 acc_sem(C)Naive standarderrorofthemean of the acrosstestcases mean accuracy.
 adjustErrorBarWidth(hE, w...Adjusts error bar widths. Use in conjunction with errorbar().
 bacc_demoSimple demo to compare accuracies and balanced accuracies.
 bacc_mean(C)Expected value of the balanced accuracy (i.e., the mean of the average of
 bacc_med(C)Median of the balanced accuracy (i.e., the median of the average of
 bacc_mode(C)Most likely balanced accuracy (i.e., the mode of the average of
 bacc_naive(C)Naive balanced accuracy (simply the mean of the individual accuracies,
 bacc_p(C)P value of the Null hypothesis that the balanced accuracy is not
 bacc_ppi(C,alpha)Posterior probability interval of the balanced accuracy.
 betaavgcdf(x, alpha1, bet...CDF of the average of two independent random variables which are
 betaavginv(y, alpha1, bet...Inverse CDF of the sum of two independent random variables which are
 betaavgpdf(x, alpha1, bet...PDF of the average of two independent random variables which are
 betaconv(res, alpha1, bet...Convolves two Beta distributions.
 betasumcdf(x, alpha1, bet...CDF of the sum of two independent random variables which are distributed
 betasumpdf(x, alpha1, bet...PDF of the sum of two independently distributed Beta distributions.

View all files
Computing the posterior balanced accuracy
by
Kay H. Brodersen
02 Nov 2010
A set of MATLAB functions for evaluating generalization performance in binary classification.

bacc_mean(C) 
% Expected value of the balanced accuracy (i.e., the mean of the average of
% two random variables that are independently distributed according to Beta
% distributions.)
%
% Usage:
% b = bacc_mean(C)
%
% Arguments:
% C  2x2 confusion matrix of classification outcomes. This matrix
% needs to be of the form C = [a b; c d] where
% <a> is the number of true positives
% <b> is the number of false negatives
% <c> is the number of false positives
% <d> is the number of true negatives
% In other words: rows are true classes, columns are estimated
% classes.
%
% Literature:
% K.H. Brodersen, C.S. Ong, K.E. Stephan, J.M. Buhmann (2010).
% The balanced accuracy and its posterior distribution. In: Proceedings
% of the 20th International Conference on Pattern Recognition.
% Kay H. Brodersen, ETH Zurich, Switzerland
% http://people.inf.ethz.ch/bkay/
% $Id: bacc_mean.m 8245 20101022 12:57:51Z bkay $
% 
function b = bacc_mean(C)
A1 = C(1,1) + 1;
B1 = C(1,2) + 1;
A2 = C(2,2) + 1;
B2 = C(2,1) + 1;
res = 0.001;
x = 0:res:2;
c = betaconv(res, A1, B1, A2, B2);
b = sum(x.*c/2) * res;
end


Contact us