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

File: <base>/sources/alistairewj_at_gmail.com/entry1/pniLouis.m (1,618 bytes)
function [ pred ] = pniLouis(data)
%PNILOUIS	Louis's initial entry - severity of illness score
%	[ pred ] = pniLouis(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:13
%	Contact: alistairewj@gmail.com


mdl=load('ModelC.mat');
[ d1,d2 ] = pniExtractFeaturesC(data);
D1var = [true(1,size(d1,2)),false(1,size(d2,2))];
X = [d1,d2]; mu=mdl.mu; sigma=mdl.sigma;
for v=1:size(X,2) % normalize
    if sigma(v)~=0
        X(:,v) = (X(:,v)-mu(v))/sigma(v);
    end
end
% Impute 0 for NaNs
X(isnan(X)) = 0;

[ pred ] = pniClassifyC(X,mdl,D1var);

end