Skip to content

Commit 2014866

Browse files
author
Florence Bockting
committed
tests/docs: update tests and vignette wrt updated user message
1 parent 0b6eb24 commit 2014866

3 files changed

Lines changed: 24 additions & 27 deletions

File tree

tests/testthat/_snaps/loo_subsampling_cases.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
print(looss_1)
55
Output
66
7-
Computed from 4000 by 100 subsampled log-likelihood
8-
values from 3020 total observations.
7+
Subsampling loo uses 1) faster, more biased computation with 3020 log-lik.
8+
terms, and 2) slower, more accurate computation with 100 subsampled terms.
99
1010
Estimate SE subsampling SE
1111
elpd_loo -1968.5 15.6 0.3
@@ -24,8 +24,8 @@
2424
print(looss_1b)
2525
Output
2626
27-
Computed from 4000 by 200 subsampled log-likelihood
28-
values from 3020 total observations.
27+
Subsampling loo uses 1) faster, more biased computation with 3020 log-lik.
28+
terms, and 2) slower, more accurate computation with 200 subsampled terms.
2929
3030
Estimate SE subsampling SE
3131
elpd_loo -1968.3 15.6 0.2
@@ -44,7 +44,7 @@
4444
print(aploo_1)
4545
Output
4646
47-
Computed from 2000 by 3020 log-likelihood matrix.
47+
Computed from 2000 posterior draws and 3020 log-likelihood terms.
4848
4949
Estimate SE
5050
elpd_loo -1968.4 15.6
@@ -64,8 +64,8 @@
6464
print(looapss_1)
6565
Output
6666
67-
Computed from 2000 by 100 subsampled log-likelihood
68-
values from 3020 total observations.
67+
Subsampling loo uses 1) faster, more biased computation with 3020 log-lik.
68+
terms, and 2) slower, more accurate computation with 100 subsampled terms.
6969
7070
Estimate SE subsampling SE
7171
elpd_loo -1968.2 15.6 0.4
@@ -85,8 +85,8 @@
8585
print(looss_2)
8686
Output
8787
88-
Computed from 4000 by 100 subsampled log-likelihood
89-
values from 3020 total observations.
88+
Subsampling loo uses 1) faster, more biased computation with 3020 log-lik.
89+
terms, and 2) slower, more accurate computation with 100 subsampled terms.
9090
9191
Estimate SE subsampling SE
9292
elpd_loo -1952.0 16.2 0.2

tests/testthat/test_loo_subsampling_cases.R

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,10 @@ test_that("Test loo_subsampling and loo_approx with radon data", {
178178
print(loo_ss),
179179
"Posterior approximation correction used\\."
180180
))
181-
expect_output(print(loo_ss), "subsampled log-likelihood terms")
181+
expect_output(print(loo_ss), "Subsampling loo uses 1) faster,")
182182

183183
expect_output(print(loo_ap_ss), "Posterior approximation correction used\\.")
184-
expect_output(print(loo_ap_ss), "subsampled log-likelihood terms")
184+
expect_output(print(loo_ap_ss), "Subsampling loo uses 1) faster,")
185185

186186
expect_output(
187187
print(loo_ap_ss_full),
@@ -369,11 +369,8 @@ test_that("Test the vignette", {
369369
loo_approximation_draws = 100
370370
)
371371
)
372-
expect_output(
373-
print(looss_2),
374-
"faster but more biased computation with 4000 posterior draws and 3020 log-likelihood terms"
375-
)
376-
expect_output(print(looss_2), "slower but more accurate computation with 4000 posterior draws and 100 subsampled log-likelihood terms")
372+
expect_output(print(looss_2), "Subsampling loo uses 1) faster,")
373+
expect_output(print(looss_2), "Subsampling loo uses 1) faster,")
377374
expect_output(
378375
print(looss_2),
379376
"MCSE and ESS estimates assume independent draws"

vignettes/loo2-large-data.Rmd

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ print(loo_ss_1)
188188
```
189189

190190
```
191-
Computed from 4000 posterior draws and 100 subsampled log-likelihood
192-
terms from 3020 total observations.
191+
Subsampling loo uses 1) faster, more biased computation with 3020 log-lik.
192+
terms, and 2) slower, more accurate computation with 100 subsampled terms.
193193
194194
Estimate SE subsampling SE
195195
elpd_loo -1968.5 15.6 0.3
@@ -235,13 +235,13 @@ loo_ss_1b <-
235235
r_eff = r_eff,
236236
draws = parameter_draws_1,
237237
data = stan_df_1
238-
)
238+
)
239239
print(loo_ss_1b)
240240
```
241241

242242
```
243-
Computed from 4000 posterior draws and 200 subsampled log-likelihood
244-
terms from 3020 total observations.
243+
Subsampling loo uses 1) faster, more biased computation with 3020 log-lik.
244+
terms, and 2) slower, more accurate computation with 200 subsampled terms.
245245
246246
Estimate SE subsampling SE
247247
elpd_loo -1968.3 15.6 0.2
@@ -285,8 +285,8 @@ print(loo_ss_1c)
285285

286286

287287
```
288-
Computed from 4000 posterior draws and 100 subsampled log-likelihood
289-
terms from 3020 total observations.
288+
Subsampling loo uses 1) faster, more biased computation with 3020 log-lik.
289+
terms, and 2) slower, more accurate computation with 100 subsampled terms.
290290
291291
Estimate SE subsampling SE
292292
elpd_loo -1968.9 15.4 0.5
@@ -375,8 +375,8 @@ print(loo_ap_ss_1)
375375
```
376376

377377
```
378-
Computed from 2000 posterior draws and 100 subsampled log-likelihood
379-
terms from 3020 total observations.
378+
Subsampling loo uses 1) faster, more biased computation with 3020 log-lik.
379+
terms, and 2) slower, more accurate computation with 100 subsampled terms.
380380
381381
Estimate SE subsampling SE
382382
elpd_loo -1968.2 15.6 0.4
@@ -455,8 +455,8 @@ print(loo_ss_2)
455455
```
456456

457457
```
458-
Computed from 4000 posterior draws and 100 subsampled log-likelihood
459-
terms from 3020 total observations.
458+
Subsampling loo uses 1) faster, more biased computation with 3020 log-lik.
459+
terms, and 2) slower, more accurate computation with 200 subsampled terms.
460460
461461
Estimate SE subsampling SE
462462
elpd_loo -1952.0 16.2 0.2

0 commit comments

Comments
 (0)