From: lama on
Hi,

I need a help with BIC algorithm I implemented the BIC as explained in Scott. Chen " Speaker, Environment and Channel change detection and clustering via the bayesian information criterion" paper

and my code is not give the right value. For example I need to send 2 segments and the BIC value must be <0 if they are not from the same speaker and >0 if they are from the same speaker.

My code:

function BIC = bicincrease(A, B, N, d)
% A is the first cluster
% B is the second cluster
% N is the number of items in the original data set
% d is the number of dimensions
%-----------------------------------

sz1 = size(A);
n1 = sz1(1);
disp(n1);
detsigma1 = abs(det(cov(A)));

sz2 = size(B);
n2 = sz2(1);
disp(n2);
detsigma2 = abs(det(cov(B)));

C = [A; B];
n = n1 + n2;
disp(n);
detsigma =abs(det(cov(C)));

a=n * log(detsigma);
b=n1 * log(detsigma1);
c=n2 * log(detsigma2);
p=0.5*(d + 0.5 * d * (d + 1))*log(n);

BIC = a-b-c-p;