Predicting Mortality of ICU Patients: The PhysioNet/Computing in Cardiology Challenge 2012 1.0.0
(2,968 bytes)
function [ X ] = pniExtractFeaturesD(data)
%PNINIC Nic's initial entry
% [ pred ] = pniNic(data) calculates a mortality prediction for each
% each row (observation/subject) in data
%
% The score uses the following variables:
% urine, platelets, BUN, creatinine, PaFi ratio, PaO2, PaCO2, pH,
% heart_rate, temperature, BP, and age.
%
% Inputs:
% data - Cell array of data.
% Column 1 - Subject IDs
% Column 2 - Time stamp vectors for each subject
% Column 3 - Feature name vectors for each subject
% Column 4 - Data value vectors for each subject
%
% Outputs:
% pred - Column vector of predictions
%
% Example
% %=== Load data in
% load('data_processed_cell.mat');
%
% %=== Calculate score
% [ score ] = pniAndrew(data);
%
% See also PNMAIN PNPREPROCESSDATA
% References:
% Physionet Challenge 2012
% http://physionet.org/challenge/2012/
%
% Copyright 2012 Alistair Johnson
% $LastChangedBy: alistair $
% $LastChangedDate: 2012-04-25 01:26:50 +0100 (Wed, 25 Apr 2012) $
% $Revision: 344 $
% Originally written on GLNXA64 by Alistair Johnson, 15-Apr-2012 14:40:40
% Contact: alistairewj@gmail.com
N = size(data,1);
%=== Generate labels
header={'Age','BUN','Creatinine','GCS','Gender',...
'Glucose','HCO3','HCT','Height','HR','K',...
'Mg','Na','NIDiasABP','NIMAP','NISysABP',...
'Platelets','RespRate','Temp','Urine','WBC',...
'Weight','DiasABP','FiO2','MAP','MechVent',...
'PaCO2','PaO2','pH','SaO2','SysABP',...
'Albumin','ALP','ALT','AST',...
'Bilirubin','Lactate','Cholesterol','TroponinI','TroponinT'};
%=== Pre-allocate
X.last = nan(N,numel(header));
X.total = nan(N,numel(header));
X.median = nan(N,numel(header));
X.maximum = nan(N,numel(header));
X.minimum = nan(N,numel(header));
for k=1:numel(header)
temp = pnExtractField(data,header{k});
idxEmpty = ~cellfun(@isempty,temp(:,4));
X.last(idxEmpty,k) = cellfun(@(x) x(end), temp(idxEmpty,4));
X.total(idxEmpty,k) = cellfun(@(x) numel(x), temp(idxEmpty,4));
X.median(idxEmpty,k) = cellfun(@(x) median(x), temp(idxEmpty,4));
X.maximum(idxEmpty,k) = cellfun(@(x) max(x), temp(idxEmpty,4));
X.minimum(idxEmpty,k) = cellfun(@(x) min(x), temp(idxEmpty,4));
end
%=== Combine into one data matrix
% The first 41 columns are the last values for each of Age, BUN, Creatinine....
% The next 41 columns are the total number of values for each of Age, BUN, Creatinine....
% The next 41 columns are the median values for each of Age, BUN, Creatinine....
% The next 41 columns are the maximum values for each of Age, BUN, Creatinine....
% The next 41 columns are the minimum values for each of Age, BUN, Creatinine....
X = [X.last,X.total,X.median,X.maximum,X.minimum];
%=== Add in severity score/day difference
[ X1 ] = pniAndrew(data);
[ X2 ] = pniLouis(data);
X = [X,X1,X2];
end