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

loo_varsel(): Different weights of clustered draws? #212

Closed
fweber144 opened this issue Sep 24, 2021 · 1 comment
Closed

loo_varsel(): Different weights of clustered draws? #212

fweber144 opened this issue Sep 24, 2021 · 1 comment

Comments

@fweber144
Copy link
Collaborator

If I understand these lines:

projpred/R/cv_varsel.R

Lines 386 to 406 in 9c7fd06

mu_k <- family$mu_fun(submodels[[k]]$sub_fit,
obs = inds,
offset = refmodel$offset,
weights = 1)
log_lik_sub <- t(family$ll_fun(
mu_k, submodels[[k]]$dis,
y[inds], refmodel$wobs[inds]
))
sub_psisloo <- suppressWarnings(
loo::psis(-log_lik_sub,
cores = 1,
r_eff = rep(1, ncol(log_lik_sub)))
)
lw_sub <- suppressWarnings(loo::weights.importance_sampling(sub_psisloo))
loo_sub[inds, k] <- apply(
log_lik_sub[,] + lw_sub[,], 2,
log_sum_exp
)
for (i in seq_along(inds)) {
mu_sub[inds[i], k] <- mu_k[i, ] %*% exp(lw_sub[, i])
}
correctly, then loo_varsel() does not take into account here that clustered draws may have different weights when averaging across them. Is my understanding correct and, if yes, is this done on purpose?

fweber144 added a commit to fweber144/projpred that referenced this issue Jan 14, 2022
AlejandroCatalina pushed a commit that referenced this issue Jan 24, 2022
* Minor cleaning (the use of `[,]` makes things just more complicated as

dimensions could be dropped accidentally).

* Fix issue #212.
@fweber144
Copy link
Collaborator Author

Fixed in develop, so a corresponding label may be added here.

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

No branches or pull requests

1 participant