Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix translation of log liks before exponentiation #1057

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

avehtari
Copy link
Contributor

Should fix stan-dev/loo#272.

$loo() had the following line

r_eff <- loo::relative_eff(exp(LLarray + max(-LLarray)), cores = r_eff_cores)

It was possible to get Inf from exp, and the autocovariance function failed with input which was all Inf. There are two issued with this line, 1) it's using the maximum of whole -LLarray, but it would be better to translate each variable in LLarray with its own maximum, and 2) it's making the smallest value 0, while it should be the largest value which is 0. This PR fixes these two issues.

Copy link
Collaborator

@andrjohns andrjohns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks Aki!

@andrjohns andrjohns merged commit ce58981 into master Jan 15, 2025
11 checks passed
@jgabry jgabry deleted the fix_loo_r_eff_overflow branch January 15, 2025 16:24
@jgabry
Copy link
Member

jgabry commented Jan 15, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants