1

I want to fit Gaussian mixture model in MATLAB. Specifically, I want to fit hundreds of models from different starting points and fit them for a few EM iterations (e.g. 10). The final aim is to use genetic algorithms to search for a good model.

Fitting mixture models is time consuming so I was wondering if there is any fast implementation that runs on gpu using MATLAB's parallel processing toolbox? I tried implementing a naive gpu version by passing gpuArray to the gmcluster function and changing appropriate variables in gmcluster and associated files to gpuArray. This actually made the runtime worse (on a particular dataset CPU time 0.1 while GPU 0.2).

Is there any improvements that can be done to the naive gpu implementation? (I am a newbie to gpu programming).

I am aware that there are some implementations e.g. the one here but it is not flexible enough to take in mean and covariance starting parameters.

I will appreciate any help/pointers.

Thanks

EDIT: Here is the part of the code that takes quite some time and I would like to run on the GPU. The code calculates mean in mu and covariance in Sigma given a probability membership matrix post for each og the k Gaussians.

for j = 1:k
    mu(j,:) = post(:,j)' * X / PComponents(j);
    Xcentered = bsxfun(@minus, X, mu(j,:));
    Xcentered = bsxfun(@times,sqrt(post(:,j)),Xcentered);
    Sigma(:,:,j) = Xcentered'*Xcentered/S.PComponents(j)+ regVal*eye(d);
end

Where:

size(X) = [n,d]
size(mu) = [k,d]
size(Sigma) = [d,d,k]
size(PComponents) = [k]

For my purposes n is inbetween 1000 and 10,000, d is around 10 and k is in between 2 and 15.

talonmies
  • 70,661
  • 34
  • 192
  • 269
Krrr
  • 452
  • 1
  • 3
  • 15

0 Answers0