fminsearch ''freezing''
Show older comments
Hi
I switched to "fminsearch" for a maximum likelihood estimation in my thesis and i started having issues with the optimization just stopping mid iteration. To be more specific, the iteration normaly takes around 2-3 seconds each but it won't start again even if i wait 1h+.
Matlab look like it still running (the above play button) but workload on the CPU is 0% and no error message.
It seem like a random problem, i'm working with simulated data and it happen once in a while but make me obligated to start all over again...
3 Comments
But first, you can try re-running with
>> dbstop if naninf
to try to trap any unexpected NaNs or infinite values that are developing part way through your calculations. Arithmetic with NaNs could explain the long computation time.
Matt J
on 11 Jun 2019
Samuel's comment moved here:
Might be a silly question but is fminsearch robust to NaN value? I first used fmincon-interior point with success and needed to switch to a derivative-free one for the next step in my project.
here are my options
options = optimset('Display','iter','MaxFunEvals',10000,'MaxIter',10000);[parametres,fval,exitflag]=fminsearch(@(param)logL(param,S,R,rf,y,I,K,T,ZC,TYPE),START_,options);
The logL function uses a parfor-loop for it's computation and numerical integrations. The logL function does have NaN values at certain points and i could get around the problem with bounds+non-linear contraints with fmincon (who's also robust to NaN).
I also tried on my personnal computer and the server i run the program, same problem. Most of the time it converge to a solution but about 1/25 time it just freeze as i described.
Accepted Answer
More Answers (0)
Categories
Find more on Mathematics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!