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

File: <base>/sources/Mneimneh/PredictAHE.m (1,899 bytes)
function [class] = PredictAHE(ABPMeanSignal,freq)
% function [class] = PredictAHE(ABPMeanSignal,freq)
%
% Input Variables
%   ABPMeanSignal- mean ABP signal
%   freq- sampling frequency of the mean ABP signal
%
% Output Variables
%   class - Classficiation whether 'Class C' (no episode of acute
%   hypotension) or 'Class H' (episode of acute hypotension is probable)
%
% Description
%   Predicts based on a twenty minute history whether a patient will have
%   an episode of acute hypotension.
% Created
%   8/31/2009, Mohamed A Mneimneh, Mohamed.Mneimneh@gmail.com
%
% This software is released under the terms of the GNU General
% Public License (http://www.gnu.org/copyleft/gpl.html).
% Modified
sec2min = 60;

if (nargin < 2)
   error 'Please input ABP mean signal, and sampling frequency'
   
end

if (length(ABPMeanSignal)/(freq*sec2min) > 20 )
    avgABPMean = average(ABPMeanSignal(end-20*(freq*sec2min):end));
    if (avgABPMean > 71)
        class = 'Class C';
    else
        class = 'Class H';
    end
else
    error 'Atleast 20 minutes of ABP mean is required'
end

end

function avg = average(timeseries)
% function avg = average(timeseries)
%
% Input Variables
%   timeseries- timeseries
%
% Output Variables
%   avg - the average without taking into consideration nan and zeroes
%
% Description
%   Calculates the average of the time series without taking into
%   consideration zeroes or nan.
% Created
%   8/31/2009, Mohamed A Mneimneh, Mohamed.Mneimneh@gmail.com
%
% This software is released under the terms of the GNU General
% Public License (http://www.gnu.org/copyleft/gpl.html).
% Modified
count = 0;
total = 0;
for i = 1:length(timeseries)
    if isnan(timeseries(i)) || timeseries(i) == 0
        continue;
    end
    total = total + timeseries(i);
    count = count + 1;
end

avg = total/count;
end