Skip to content

Commit

Permalink
Fix logical error in an exceptional case in Tweedie dispersion estima…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
tomasfryda committed Jan 19, 2024
1 parent a535e92 commit 5e8fc7f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions h2o-algos/src/main/java/hex/glm/DispersionUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,15 @@ private static double goldenRatioDispersionSearch(GLMModel.GLMParameters parms,

double midLoPhi = sortedPhis.get(counter - 2);
double midLoLLH = sortedLLHs.get(counter - 2);
if (midLoPhi > upperBound) {
double midHiPhi = lowPhi + d;
double midHiLLH = getTweedieLogLikelihood(parms, dinfo, midHiPhi, mu);
if (midLoPhi > midHiPhi) {
midLoPhi = hiPhi - d;
midLoLLH = getTweedieLogLikelihood(parms, dinfo, midLoPhi, mu);
}
double midHiPhi = lowPhi + d;
double midHiLLH = getTweedieLogLikelihood(parms, dinfo, midHiPhi, mu);
assert lowerBound <= midLoPhi;
assert midLoPhi <= midHiPhi;
assert midHiPhi <= upperBound;
for (; counter < iterationsLeft; counter++) {
Log.info("Tweedie golden-section search[iter=" + counter + ", phis=(" + lowPhi + ", " + midLoPhi +
", " + midHiPhi + ", " + hiPhi + "), likelihoods=(" +
Expand Down

0 comments on commit 5e8fc7f

Please sign in to comment.