Error using parfor: cannot use parfor because of the way Theta/nk is used
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello everyone, I am using a very old version of Xeon PC to run a gaussian mixture model using Dirichlet process and Gibb's sampling on a Big Data. I hoped I could speed it up using parfor commands but was unable to do it becuase of the error!!
n = size(X,2);
Theta = {};
nk = [];
label = zeros(1,n);
llh = 0;
for i = randperm(n)
x = X(:,i);
Pk = log(nk)+cellfun(@(t) t.logPredPdf(x), Theta);
P0 = log(alpha)+theta.logPredPdf(x);
p = [Pk,P0];
llh = llh+sum(p-log(n));
k = discreteRnd(exp(p-logsumexp(p)));
if k == numel(Theta)+1
Theta{k} = theta.clone().addSample(x);
nk = [nk,1];
else
Theta{k} = Theta{k}.addSample(x);
nk(k) = nk(k)+1;
end
label(i) = k;
end
w = nk/n;
Please note that the first function I used above provided faster results so, I am not worried about it very much.
Thanks and Regards in advance.
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!