Skip to content

Commit

Permalink
Don't recompute average when guessing intercept (#750)
Browse files Browse the repository at this point in the history
  • Loading branch information
lbittarello committed Jan 12, 2024
1 parent 81b6f3b commit 89be1ac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/glum/_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,7 @@ def guess_intercept(
second = np.log((mu ** (2 - p)).dot(sample_weight))
return first - second
elif isinstance(link, LogitLink):
log_odds = np.log(avg_y) - np.log(np.average(1 - y, weights=sample_weight))
log_odds = np.log(avg_y) - np.log(1 - avg_y)
if eta is None:
return log_odds
avg_eta = eta if np.isscalar(eta) else np.average(eta, weights=sample_weight)
Expand Down

0 comments on commit 89be1ac

Please sign in to comment.