Predicting Acute Hypotensive Episodes: The PhysioNet/Computing in Cardiology Challenge 2009 1.0.0

File: <base>/sources/Jousset/f_predict_AHE.m (1,209 bytes)
function class = f_predict_AHE(record)
%/* f_predict_AHE.m
%         forecast acute hypotension using an SVM structure build from
%         training data
%         Copyright (C) 2009  Florian Jousset <florian.jousset at epfl.ch>
%         This software is released under the terms of the GNU General
%         Public License (http://www.gnu.org/copyleft/gpl.html).
%      */
%
% CLASS = F_PREDICT_AHE(RECORD)
%
% INPUT
%   record      record ID, '201bn'
%
% OUTPUT
%   class       classification 'H' | 'C'

% load the arterial blood pressure signals
[ABP] = f_load_ABPs_test(record);

% select the mean ABP
ABP.M(ABP.M == 0) = [];
ABP.M = resample(ABP.M,1,60);

% keep only the last 2 hours
x = ABP.M(end-119:end);
medM = median(x);
madM = mad(x,1);

% compute the slope of the last 20 min
x = x(end-19:end);
brob = robustfit((1:length(x)), x);
slope = brob(2);

params = [medM, madM, slope];

% classify
if strcmp(record(1), '1')
    load svmStructA
    class = svmclassify(svmStructA,params(1:2));
else
    load svmStructB
    class = svmclassify(svmStructB,params);
end

if class
    class = 'H';
else
    class = 'C';
end

disp([record '       ' class]);