Predicting Mortality of ICU Patients: The PhysioNet/Computing in Cardiology Challenge 2012 1.0.0
(5,656 bytes)
function BEST_DATA=COMB_classification(R,IHD,time_series_names,MD_DATA_D,MD_DATA_DD,MD_DATA,DESCRIPTORS,des_names)
num_params=size(R,2);
DATA=zeros(size(R,1),3);
include=zeros(size(R,2),1);
for par_idx=1:num_params
X=R(:,par_idx);
B = mnrfit(X,IHD+1);
PHAT = mnrval(B,X);
max_score1=0;
max_score2=0;
best_th=0;
for class_th=.1:.01:0.5
DATA(:,1)=str2double('0000');
DATA(:,2)=PHAT(:,2);
DATA(:,3)=PHAT(:,2)> class_th;
DATA(DATA(:,2)<0.01,2)=0.01;
DATA(DATA(:,2)>0.99,2)=0.99;
% if(~isempty(results))
% Calculate sensitivity (Se) and positive predictivity (PPV)
TP=sum(DATA(IHD==1,3));
FN=sum(~DATA(IHD==1,3));
FP=sum(DATA(IHD==0,3));
Se=TP/(TP+FN);
PPV=TP/(TP+FP);
show=0; % if show is 1, the decile graph will be displayed by lemeshow()
H=lemeshow([IHD DATA(:,2)],show);
% Use the title of figure to display the results
title(['H= ' num2str(H) ' Se= ' num2str(Se) ' PPV= ' num2str(PPV) '. ' num2str(class_th) ])
% The event 1 score is the smaller of Se and PPV.
score1 = min(Se, PPV);
if score1>max_score1
max_score1=score1;
best_th=class_th;
max_score2=H;
% display(['Unofficial Event 1 score: ' num2str(score1)]);
end
% end
end
survivals1=sum(X==1 & IHD==0);
deaths1=sum(X==1 & IHD==1);
survivals2=sum(X==0 & IHD==0);
deaths2=sum(X==0 & IHD==1);
if max_score1>0
% include(par_idx)=1;
disp(' ---')
disp([' non NaNs:' num2str(deaths1/(deaths1+survivals1)) ])
disp([' NaNs:' num2str(deaths2/(deaths2+survivals2)) ])
ratio=(deaths1/(deaths1+survivals1)) / (deaths2/(deaths2+survivals2))
name= time_series_names{par_idx}
score= max_score1
disp(' ---')
if ratio >1.5 || ratio <0.6
include(par_idx)=1;
end
end
end
num_params=size(R,2);
DATA=zeros(size(R,1),3);
%for par_idx=1:num_params
X1=R(:,include==1);
min_numdata1=min(sum(~isnan(MD_DATA_D),2));
min_numdata2=min(sum(~isnan(MD_DATA_DD),2));
MD_DATA_D=MD_DATA_D(:,1:min_numdata1);
MD_DATA_DD=MD_DATA_DD(:,1:min_numdata2);
X2=[MD_DATA_D MD_DATA_DD MD_DATA];
AGE_a=DESCRIPTORS(:,strcmp(des_names,'Age'));
Gender_a=DESCRIPTORS(:,strcmp(des_names,'Gender'));
ICUTYPE_a=[DESCRIPTORS(:,strcmp(des_names,'ICUType'))];
ICUTYPE_t=ICUTYPE_a;
ICUTYPE_a(ICUTYPE_t==1)=2;
ICUTYPE_a(ICUTYPE_t==2)=4;
ICUTYPE_a(ICUTYPE_t==3)=1;
ICUTYPE_a(ICUTYPE_t==4)=3;
X2=[AGE_a ICUTYPE_a X2];
X=[X1 X2];
%0.2708
%X=[R(:,~strcmp(time_series_names,'MechVent'))];
%0.277
% X=[R(:,strcmp(time_series_names,'TroponinT'))];
% X=[R(:,strcmp(time_series_names,'TroponinI')) X];
% X=[R(:,strcmp(time_series_names,'RespRate')) X];
% X=[R(:,strcmp(time_series_names,'Mg')) X];
% X=[R(:,strcmp(time_series_names,'Lactate')) X];
% X=[R(:,strcmp(time_series_names,'K')) X];
% X=[R(:,strcmp(time_series_names,'FiO2')) X];
% X=[R(:,strcmp(time_series_names,'Bilirubin')) X];
% X=[R(:,strcmp(time_series_names,'AST')) X];
% X=[R(:,strcmp(time_series_names,'ALT')) X];
% X=[R(:,strcmp(time_series_names,'ALP')) X];
% X=[R(:,strcmp(time_series_names,'Albumin')) X];
%
B = mnrfit(X,IHD+1);
PHAT = mnrval(B,X);
max_score1=0;
max_score2=0;
best_th=0;
for class_th=.1:.01:0.5
DATA(:,1)=str2double('0000');
DATA(:,2)=PHAT(:,2);
DATA(:,3)=PHAT(:,2)> class_th;
DATA(DATA(:,2)<0.01,2)=0.01;
DATA(DATA(:,2)>0.99,2)=0.99;
% if(~isempty(results))
% Calculate sensitivity (Se) and positive predictivity (PPV)
TP=sum(DATA(IHD==1,3));
FN=sum(~DATA(IHD==1,3));
FP=sum(DATA(IHD==0,3));
Se=TP/(TP+FN);
PPV=TP/(TP+FP);
show=0; % if show is 1, the decile graph will be displayed by lemeshow()
H=lemeshow([IHD DATA(:,2)],show);
% Use the title of figure to display the results
title(['H= ' num2str(H) ' Se= ' num2str(Se) ' PPV= ' num2str(PPV) '. ' num2str(class_th) ])
% The event 1 score is the smaller of Se and PPV.
score1 = min(Se, PPV);
if score1>max_score1
max_score1=score1;
best_th=class_th;
max_score2=H;
BEST_DATA=DATA;
% display(['Unofficial Event 1 score: ' num2str(score1)]);
end
% end
end
% survivals1=sum(X==1 & IHD==0);
% deaths1=sum(X==1 & IHD==1);
% survivals2=sum(X==0 & IHD==0);
% deaths2=sum(X==0 & IHD==1);
%
% disp([' non NaNs:' num2str(deaths1/(deaths1+survivals1)) ])
% disp([' NaNs:' num2str(deaths2/(deaths2+survivals2)) ])
%
max_score1
end