-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
subsampling LOO estimates with diff-est-srs-wor start #496
base: master
Are you sure you want to change the base?
Conversation
This reverts commit 781e331.
I wanted to use R2, and as I had rewrote summary stats anyway, added R2 and made all mse, rmse, and R2 to use only normal approximation with as much shared computation as possible With the added R2 support, this PR will close also #483 |
I can take a look |
I have added some comments, but I'm not done with the review yet. Besides, I think documentation needs to be updated (at least re-roxygenized, but also progressr should be mentioned), the vignettes perhaps as well, and I haven't run |
applied to the subsampled LOO results)
also need to be applied to the subsampled LOO results)
While working on the tests, I discovered a few bugs and fixed them. However (apart from what is still open in the comments above), we still need to think about the following:
For the tests, I think it would make sense to add subsampled-LOO Finally, while experimenting with the tests, I discovered some strange projpred/tests/testthat/test_varsel.R Lines 1452 to 1456 in 7469aea
excl_nonargs(args_cvvs_i, nms_excl_add = "validate_search") ) on tstsetup <- "rstanarm.glm.cumul.stdformul.without_wobs.with_offs.latent.default_meth.default_cvmeth.default_search_trms" . This needs to be investigated.
|
`validate_search = FALSE`, the search is not run again when creating `summaries_fast`. Only the performance evaluation (including the re-projections required for it) is run again. Hence, it would be inconsistent to treat `summaries_fast` like the search-related arguments of `cv_varsel.refmodel()` when calling `cv_varsel.refmodel()` from within `cv_varsel.vsel()`. Thus, a lot of code related to `summaries_fast` can be removed, which is done here.
I think I have forgotten the context to understand this question
Fine for me. NA handling was there before I started this PR, and I left most of that there. |
No problem, I think I figured this out and pushed commit 0dcfcf2 which resolves this.
Ok, I will check this in detail and will commit changes (if possible). |
why some test snapshots changed unexpectedly).
I just pushed commit 6151b0c which reverts changes that are unrelated to subsampled LOO-CV because I observed some unexpected changes in the test snapshots. The state before reverting these subsampling-unrelated changes is now in branch Lines 797 to 891 in 6151b0c
Lines 819 to 902 in 0dcfcf2
misc_from_fix-subsampling ) after this PR has been merged. And, of course, there is still branch mixed_deltas_plot which needs to be worked on and eventually merged as well.
|
I just pushed commit 360354a which ensures that the tests run through with this PR. The changes in the test snapshots are now as expected. However, the parts
and
from #496 (comment) are still to-do. |
This reverts commit 0bd3830. Reason for the revert: The "fix" from that commit would have to take `summaries_fast` into account as well. For simplicity, we will avoid the early check for all-`NA`s in `get_stat()` in its entirety.
this ensures `all(wobs == 1)` after lines ``` wobs <- rep(wobs, y_wobs_test$wobs) wobs <- n_full * wobs / sum(wobs) ``` (but note that `NA`s in `mu` should lead to `NA` output anyway).
I have now investigated the
above. It turned out that we can indeed leave (unexpected) To ensure that Concerning the tests, it would be good to add more detailed (not only |
Sure |
Great, I'll do this asap. |
A new issue I discovered: In Lines 353 to 354 in 8666643
data("df_binom", package = "projpred")
dat <- data.frame(y = df_binom$y, df_binom$x)
rfit <- rstanarm::stan_glm(y ~ X1 + X2 + X3, family = binomial(), data = dat,
chains = 1, iter = 500, seed = 987, refresh = 0)
devtools::load_all()
cvvs <- cv_varsel(rfit, cv_method = "kfold", validate_search = FALSE, method = "L1",
nclusters_pred = 2, seed = 123, latent = TRUE)
summary(cvvs, deltas = TRUE, stats = c("elpd", "mlpd", "gmpd", "mse", "rmse", "acc", "auc"), seed = 456) gives me a non-zero
The same holds for the "best" submodel (the size 1 submodel) in summary(cvvs, deltas = TRUE, stats = c("elpd", "mlpd", "gmpd", "mse", "rmse", "acc", "auc"), seed = 456,
baseline = "best") which yields
When dividing by Lines 353 to 354 in 8666643
mse.se and rmse.se for the reference model and the "best" submodel (both with deltas = TRUE ) as desired.
When changing this, we should also check for similar division issues in @avehtari: Could you check this (and fix, if it is really incorrect)? |
Dividing by n_full-1 makes sense as we're using sd() for full LOO estimator. I don't have time to do any coding until after November 25 |
Done in commit e8f17e8. |
Work in progress.
Tested with
Notes
cv_varsel
if nloo<n and fast PSIS-LOO result is not yet available, fast PSIS-LOO result is computedcv_varsel
if nloo<n, fast PSIS-LOO result is stored in slot $summaries_fastNext
tagging @n-kall