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

File: <base>/sources/alistairewj_at_gmail.com/entry8/pnFeatures.m (2,515 bytes)
function [ X,header ] = pnFeatures(data,featType)
%PNFEATURES	Extract features for a given model
%	[ X,header ] = pnFeatures(data,featType) extracts features for the data
%	given the type of features requested. These features are in double
%	matrix form and can be used in model development algorithms.
%	
%	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
%
%		featType	- The type of features to extract
%
%	Outputs:
%		X		- Double matrix NxD with D features needed for training.
%		header	- Cell array 1xD of labels for each feature used.
%		
%
%	Example
%		bpath = './set-a/';
%		data = pnLoadTextFilesCell(bpath);
%		stat = pnFeatures(data(1,:)) %	
%	See also PNGENERATEFEATURES

%	References:
%		Physionet Challenge 2012

%	Copyright 2012 Alistair Johnson

%	$LastChangedBy: alistair $
%	$LastChangedDate: 2012-08-23 18:39:12 -0400 (Thu, 23 Aug 2012) $
%	$Revision: 152 $
%	Originally written on GLNXA64 by Alistair Johnson, 21-Jun-2012 13:00:48
%	Contact: alistairewj@gmail.com

if nargin<2
    featType = 'Base';
end

%=== Get the type of features to be extracted/default to base as needed
switch featType
    case {'Complexity'}
        featfcn = @pnComplexityFeatures;
    case {'Plus'}
        featfcn = @pnPlusFeatures;
    case {'Base'}
        featfcn = @pnBaseFeatures;
    case {'Andrew'}
        featfcn = @pnAndrewFeatures;
    case {'LouisOld'}
        featfcn = @pnLouisOldFeatures;
    case {'Louis'}
        featfcn = @pnLouisFeatures;
    case {'GSO21','ReliefF1','CFS1','CBF1','jmi1','mrmr1','disr1','all1'}
        k = 1;
        featfcn = @(x) pnThanasisFeatures(x,featType,k);
    case {'GSO22','ReliefF2','CFS2','CBF2','jmi2','mrmr2','disr2','all2'}
        k = 2;
        featfcn = @(x) pnThanasisFeatures(x,featType,k);
    case {'GSO23','ReliefF3','CFS3','CBF3','jmi3','mrmr3','disr3','all3'}
        k = 3;
        featfcn = @(x) pnThanasisFeatures(x,featType,k);
        %=== default is using fold 4 of thanasis' feature selection
    case {'GSO2','ReliefF','CFS','CBF','jmi','mrmr','disr','all',...
            'GSO24','ReliefF4','CFS4','CBF4','jmi4','mrmr4','disr4','all4'}
        k = 4;
        featfcn = @(x) pnThanasisFeatures(x,featType,k);
    otherwise
        fprintf('Feature function not found! Using BASE features.');
        featfcn = @pnBaseFeatures;
end

[X,header] = featfcn(data);

end