how to fix Iteration limit reached warning
32 views (last 30 days)
Show older comments
Dear All
I am using logistic regression . I have results using glmfit but with a warning message that "iteration limit is reached". I would like to increase this limit. How to do do that when I ask "glmfit" ? beside i have to say that i tried edit glmfit, line 284, and change itration from 100 to 10000 but it dose not work.
Thank you in advance
2 Comments
John D'Errico
on 3 Sep 2014
Editing MATLAB toolbox codes is almost always a bad idea unless you know enough about the tool to have written it yourself.
Accepted Answer
Tom Lane
on 12 Sep 2014
This can be a symptom of perfect separation between the classes, or of something similar to perfect separation. Consider this:
>> x = [7 0;0 0;8 0;9 0;7 1;8 0;7 0;4 0;7 0;2 0];
>> y = [0 0 1 1 1 0 0 1 0 0]';
>> fitglm(x,y,'distr','binomial');
Warning: Iteration limit reached.
>> fitglm(x(:,2),y,'distr','binomial');
Warning: Iteration limit reached.
Warning: The estimated coefficients perfectly separate failures from successes. This means the theoretical best estimates are not
finite. For the fitted linear combination XB of the predictors, the sample proportions P of Y=N in the data satisfy:
XB=-0.693147: P=0.333333
XB>-0.693147: P=1
Here's a case where the iteration limit was met because the true parameter values are drifting off to infinity. In the second case, the function diagnosed the problem and tried to explain it. In the first case, the function was unable to diagnose the problem and just gave up.
I don't know if this is the case in your example. Do you see coefficients getting large so that x*b is big? I'd be willing to try to diagnose the problem if you want to send me your data.
More Answers (0)
See Also
Categories
Find more on Gaussian Process Regression 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!