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

File: <base>/sources/Henriques/codeMatlab/mmAHEepisode.m (1,878 bytes)
% _________________________________________________________________________
% иииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииии
% PREDICTION OF ACUTE HYPOTENSIVE EPISODES USING NEURAL NETWORK MULTIMODELS
% _________________________________________________________________________
% иииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииии
%        Copyright (C) 2009
%          : Jorge Henriques ...  <jh@dei.uc.pt>,
%          : Teresa Rocha    ...  <teresa@sun.isec.pt>
%        This software is released under the terms of the GNU
%        General Public License (http://www.gnu.org/copyleft/gpl.html)
% иииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииии
% mmAHEepisode.m
%__________________________________________________________________________
% иииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииии
% Identification of an AHE . According AHE definitons
%ииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииии OUTPUT
%  y   :  vector of data
%  ind :  indices
%  ind1:  first indice if case of AHE: X(end) if does NOT exist an episode.
%__________________________________________________________________________
% иииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииии

function [y, ind, ind1]=mmAHEepisode(X, WIN, LIM, VAL, TOL )

pmax=-1;
y=0;
N=length(X);
ind=[];
for i=1:N-WIN
    xi= X(i:i+WIN);
    id= find(xi<VAL);
    pi= length(id)/WIN;
    if pi>pmax
        pmax=pi;
    end
    if pi>=TOL
        ind=[ind;i];
        y=1;
    end
end

ind1=length(X);
if length(ind)>0
    ind1=ind(1);
end

if 0
    plot(1:N,X,'g',ind:ind+WIN,X(ind:ind+WIN),'r',1:N,60*ones(N,1),'k',ind,X(ind),'bo')
    xlabel([num2str(ind) '  '  num2str(pmax) '     y=' num2str(y)  ],'FontSize',14)
    grid
    hold on
end