Using parfor with fminsearch
이전 댓글 표시
Hi everybody. I would like to generate a distribution of parameter vectors using different subsamples. The estimates are produced using my self-defined function criterion. I have B samples, so Bsamples{b} picks out the b-th saple.
parfor b=1:B
Bresults(b,:)=fminsearch(@criterion,x,options,nsimu,Bsamples{b},0,ss);
% find estimator, x=starting parameter vector
end
While this works fine with a "for" loop, when using "parfor" it always returns the starting parameter vector as result. It seems not to recognize the different inputs Bsamples{b}. Is it in general not possible to parfor with optimization routines? Other operations, like mean(Bsample{b}) in the loop work fine.
Many thanks! Philipp
댓글 수: 1
Sean de Wolski
2013년 1월 29일
Can you provide some values? I see no reason why what you have above would not work with a parfor() loop.
Also, I would recommend using an anonymous function do pass the extra parameters:
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Parallel for-Loops (parfor)에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!