Predicting Mortality of ICU Patients: The PhysioNet/Computing in Cardiology Challenge 2012 1.0.0

File: <base>/sources/alistairewj_at_gmail.com/entry1/event2score.m (686 bytes)
function [S]=event2score(data)
%[S]=event2score(data) calculates minimum of the SE and PPV
%
%data -(Nx2) where N is the number of cases (4000 for each of sets A, B, and C),
%	     the first column is the true outcome (data(:,2) from the Outcomes file),
%            and the second column is the estimated risk (from the challenge
%            entry outputs for event2)
%


    % Calculate sensitivity (Se) and positive predictivity (PPV)
    TP=sum(data(data(:,2)==1,1));
    FN=sum(~data(data(:,2)==1,1));
    FP=sum(data(data(:,2)==0,1));  
    Se=TP/(TP+FN);
    PPV=TP/(TP+FP);
    
    % The event 1 score is the smaller of Se and PPV.
    S = min(Se, PPV);
end