% me=Yout(:,g)   system output      y=AU(:,g)*2-1  human labels
function [Aroc]=rocA(me,y)
n_fine=500;% choose this according to number output levels
for au=1:size(me,2)
  dme=max(me(:,au))-min(me(:,au));dme=n_fine/dme;
  t=floor(dme*min(me(:,au))):ceil(dme*max(me(:,au)));
  for i=1:size(t,2)
    yh=sign(me(:,au)-t(i)/dme+0.000000000001);%hack
    fa(au,i)=size(find(y(:,au)==-1&yh==1),1)/size(find(y(:,au)==-1),1);
    hit(au,i)=size(find(y(:,au)==1&yh==1),1)/size(find(y(:,au)==1),1);
  end
end

dfa=-fa(:,2:end)+fa(:,1:(end-1));
mhit=(hit(:,2:end)+hit(:,1:(end-1)))/2;
Aroc=sum([dfa.*mhit]');
