Predicting Mortality of ICU Patients: The PhysioNet/Computing in Cardiology Challenge 2012 1.0.0
(1,300 bytes)
function [ X,header, idxRem ] = pnParseData(X,header,idxRem)
%PNPARSEDATA Remove bad data features
% [ X,header ] = pnParseData(X,header) removes infinites, features which
% are singular valued, and features which are all NaNs.
%
% Inputs:
% X - Numeric matrix of data
% header - Cell array of strings
%
% Outputs:
% X - Numeric matrix of data with bad features removed
% header - Cell array of strings with bad features removed
%
%
% Example
% bpath = './set-a/';
% data = pnLoadTextFilesCell(bpath);
% [X,header] = pnExtractData(data,'first');
% [X,header] = pnParseData(X,header);
% See also PNDEVELOPMODELS PNMAIN
% References:
% Physionet Challenge 2012
% Copyright 2012 Alistair Johnson
% $LastChangedBy: alistair $
% $LastChangedDate: 2012-06-11 16:51:34 -0400 (Mon, 11 Jun 2012) $
% $Revision: 60 $
% Originally written on GLNXA64 by Alistair Johnson, 11-Jun-2012 09:13:57
% Contact: alistairewj@gmail.com
X(isinf(X)) = NaN;
if nargin<3 % idxRem not provided
idxRem = sum(isnan(X),1) > 0.99*size(X,1);
%=== Delete singular valued features
for m=1:size(X,2)
Xuniq = unique(X(:,m));
if numel(Xuniq)==1 || ( numel(Xuniq)==2 && any(isnan(Xuniq)) )
idxRem(m) = true;
end
end
end
X(:,idxRem) = [];
header(:,idxRem) = [];
end