Conversation
synced with upstream/master
as proposed by @avehtari in issue stan-dev#333
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #340 +/- ##
==========================================
- Coverage 92.78% 92.75% -0.03%
==========================================
Files 31 31
Lines 2992 2983 -9
==========================================
- Hits 2776 2767 -9
Misses 216 216 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
The example should be based on flexible enough model so that After we have useful loglik matrix, the example code would be something like This matches what someone was asking |
Either is fine by me. Also if we're only using it for this example, we could also just generate an example loglik matrix in the example code instead of storing it. |
|
I think the interesting examples can be slow to run. I'll test subsampling with few interesting real models this week |
|
Thus would be a good example with data from https://archive.ics.uci.edu/ml/datasets/wine+quality library(dplyr)
library(brms)
options(brms.backend = "cmdstanr")
options(mc.cores = 4)
library(loo)
wine <- read.delim(root("winequality-red", "winequality-red.csv"), sep = ";") |>
distinct()
wine_scaled <- as.data.frame(scale(wine))
fitos <- brm(ordered(quality) ~ .,
family = cumulative("logit"),
prior = prior(R2D2(mean_R2 = 1/3, prec_R2 = 3)),
data = wine_scaled,
seed = 1,
silent = 2,
refresh = 0)
log_lik_matrix <- log_lik(fitos)
N <- nrow(wine_scaled)
Nsub <- 100
# posterior log-score
lpd <- elpd(log_lik_matrix)
sum(lpd$pointwise[,"elpd"])
# Use PSIS-LOO for subsample of Nsub randomly selected observations
set.seed(1)
idx <- sample(1:N, Nsub)
elpd_loo_sub <- loo(log_lik_matrix[,idx])
sum(elpd_loo_sub$pointwise[,"elpd_loo"]) / Nsub * N
# Use difference estimator to combine fast result and subsampled accurate result
loo:::srs_diff_est(lpd$pointwise[,"elpd"], elpd_loo_sub$pointwise[,"elpd_loo"], idx)
# Comparison to using PSIS-LOO for all observations
loo(log_lik_matrix)
As compiling and sampling the brms model takes some time, I would store only the |
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5 to 6. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@v5...v6) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
…ns/codecov/codecov-action-6 Bump codecov/codecov-action from 5 to 6
|
Interesting, do I understand it correctly that the |
Increase touchstone iterations
Further bump up touchstone iterations
Latest R and LTS ubuntu
Bumped touchstone reqs
Update posterior gpdfit branch to get newer touchstone functionality
use posterior::gpdfit and posterior::qgeneralized_pareto()
|
Instead of generating log_lik on the fly, we could use the stored wine log_lik which was added in #352. This would make the example to run much faster. Need to check whether wine log_lik was added only for touchstone and was it too big for CRAN, @jgabry , @VisruthSK |
as proposed by @avehtari in issue stan-dev#333
…into export-srs-diff-est
|
This is how benchmark results would change (along with a 95% confidence interval in relative change) if 9dc166f is merged into master:
|
Fixes #333
Note:
@exampleyet because I did not have time yet to get fully familiar with the whole package.