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

File: <base>/sources/reko.kemppainen_at_gmail.com/entry9/getLDAweights.m (680 bytes)
function weightsLDA = getLDAweights(matrixData,clabels)

% Feature extraction based on LDA
%  
% Inputs:
%
% matrixData - d*t*n tensor containing n matrices of size d*t, where n is the number of samples.
% clabels - n-dimensional vector of binary coded category labels
%
% Ouput:
% 
% weightsLDA - d*t matrix of t-dimensional directions estimated with LDA
%
%
% Jukka-Pekka Kauppi
% jukka-pekka.kauppi@helsinki.fi
% University of Helsinki, Department of Computer Science
% 23.8.2012

siz = size(matrixData);
d = siz(1);
t = siz(2);
n = siz(3);

weightsLDA = zeros(d,t);

for m = 1:d
  X = squeeze(matrixData(m,:,:))'; % n*t matrix
  weightsLDA(m,:) = computeLDA(X,clabels);  
end