Skip to content

Commit 50c79db

Browse files
committed
updated tests after changing example data
1 parent 6136b85 commit 50c79db

File tree

4 files changed

+28
-29
lines changed

4 files changed

+28
-29
lines changed

tests/testthat/test-all_topological_sorts.R

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ test_that("precompute_topological_sorts works", {
1919

2020
expect_equal(
2121
sorts$sort_matrix,
22-
structure(c(1L, 2L, 3L, 5L, 4L, 1L, 2L, 5L, 3L, 4L, 1L, 3L, 5L,
23-
2L, 4L, 1L, 5L, 3L, 4L, 2L, 1L, 5L, 4L, 2L, 3L, 1L, 5L, 4L, 3L,
24-
2L), dim = 5:6)
22+
structure(c(5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 4L, 3L, 5L, 1L, 4L,
23+
2L, 3L), dim = c(5L, 3L))
2524
)
2625

27-
expect_equal(sorts$sort_count, 12L)
26+
expect_equal(sorts$sort_count, 8L)
2827
})

tests/testthat/test-compute_sequentially_complete.R

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ test_that("compute_sequentially works with complete data", {
77
)
88
expect_s3_class(mod, "BayesMallowsSMC2")
99
alpha_hat <- weighted.mean(x = as.numeric(mod$alpha), w = mod$importance_weights)
10-
expect_gt(alpha_hat, .99)
11-
expect_lt(alpha_hat, 1.05)
10+
expect_gt(alpha_hat, .03)
11+
expect_lt(alpha_hat, .08)
1212

1313
set.seed(2)
1414
mod <- compute_sequentially(
@@ -18,8 +18,8 @@ test_that("compute_sequentially works with complete data", {
1818
resampler = "residual")
1919
)
2020
alpha_hat <- weighted.mean(x = as.numeric(mod$alpha), w = mod$importance_weights)
21-
expect_gt(alpha_hat, .99)
22-
expect_lt(alpha_hat, 1.06)
21+
expect_gt(alpha_hat, .04)
22+
expect_lt(alpha_hat, .06)
2323

2424
set.seed(2)
2525
mod <- compute_sequentially(
@@ -29,8 +29,8 @@ test_that("compute_sequentially works with complete data", {
2929
resampler = "stratified")
3030
)
3131
alpha_hat <- weighted.mean(x = as.numeric(mod$alpha), w = mod$importance_weights)
32-
expect_gt(alpha_hat, .99)
33-
expect_lt(alpha_hat, 1.1)
32+
expect_gt(alpha_hat, .02)
33+
expect_lt(alpha_hat, .05)
3434

3535
set.seed(2)
3636
mod <- compute_sequentially(
@@ -40,6 +40,6 @@ test_that("compute_sequentially works with complete data", {
4040
resampler = "systematic")
4141
)
4242
alpha_hat <- weighted.mean(x = as.numeric(mod$alpha), w = mod$importance_weights)
43-
expect_gt(alpha_hat, .99)
44-
expect_lt(alpha_hat, 1.06)
43+
expect_gt(alpha_hat, .02)
44+
expect_lt(alpha_hat, .05)
4545
})

tests/testthat/test-compute_sequentially_partial.R

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ test_that("compute_sequentially works with partial data", {
88
max_particle_filters = 30, max_rejuvenation_steps = 5)
99
)
1010
alpha_hat <- weighted.mean(x = as.numeric(mod$alpha), w = mod$importance_weights)
11-
expect_gt(alpha_hat, .95)
12-
expect_lt(alpha_hat, 1.06)
11+
expect_gt(alpha_hat, .06)
12+
expect_lt(alpha_hat, .09)
1313

1414
set.seed(2)
1515
mod <- compute_sequentially(
@@ -20,8 +20,8 @@ test_that("compute_sequentially works with partial data", {
2020
resampler = "residual", max_rejuvenation_steps = 5)
2121
)
2222
alpha_hat <- weighted.mean(x = as.numeric(mod$alpha), w = mod$importance_weights)
23-
expect_gt(alpha_hat, .99)
24-
expect_lt(alpha_hat, 1.06)
23+
expect_gt(alpha_hat, .02)
24+
expect_lt(alpha_hat, .05)
2525

2626
set.seed(2)
2727
mod <- compute_sequentially(
@@ -35,8 +35,8 @@ test_that("compute_sequentially works with partial data", {
3535
max_rejuvenation_steps = 5)
3636
)
3737
alpha_hat <- weighted.mean(x = as.numeric(mod$alpha), w = mod$importance_weights)
38-
expect_gt(alpha_hat, .94)
39-
expect_lt(alpha_hat, 1.05)
38+
expect_gt(alpha_hat, .02)
39+
expect_lt(alpha_hat, .05)
4040

4141
set.seed(2)
4242
mod <- compute_sequentially(
@@ -50,8 +50,8 @@ test_that("compute_sequentially works with partial data", {
5050
max_rejuvenation_steps = 5)
5151
)
5252
alpha_hat <- weighted.mean(x = as.numeric(mod$alpha), w = mod$importance_weights)
53-
expect_gt(alpha_hat, .99)
54-
expect_lt(alpha_hat, 1.08)
53+
expect_gt(alpha_hat, .02)
54+
expect_lt(alpha_hat, .05)
5555
})
5656

5757
test_that("compute_sequentially works with partial data and pseudolikelihood proposal", {
@@ -67,7 +67,7 @@ test_that("compute_sequentially works with partial data and pseudolikelihood pro
6767
latent_rank_proposal = "pseudo")
6868
)
6969
alpha_hat <- weighted.mean(x = as.numeric(mod$alpha), w = mod$importance_weights)
70-
expect_gt(alpha_hat, .98)
71-
expect_lt(alpha_hat, 1.06)
70+
expect_gt(alpha_hat, .05)
71+
expect_lt(alpha_hat, .1)
7272

7373
})

tests/testthat/test-compute_sequentially_preferences.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ test_that("compute_sequentially works with preference data", {
2323
topological_sorts = topological_sorts
2424
)
2525

26-
expect_gt(mean(mod$alpha), 1)
27-
expect_lt(mean(mod$alpha), 1.02)
26+
expect_gt(mean(mod$alpha), .2)
27+
expect_lt(mean(mod$alpha), .3)
2828
})
2929

3030
test_that("compute_sequentially works with preference data and tracing", {
@@ -55,8 +55,8 @@ test_that("compute_sequentially works with preference data and tracing", {
5555

5656
expect_equal(length(mod$alpha_traces), 3)
5757
expect_equal(length(mod$alpha_traces[[2]]), 100)
58-
expect_gt(mod$alpha_traces[[2]][[3]], .24)
59-
expect_lt(mod$alpha_traces[[2]][[3]], .25)
58+
expect_gt(mod$alpha_traces[[2]][[3]], .49)
59+
expect_lt(mod$alpha_traces[[2]][[3]], .51)
6060

6161
set.seed(3)
6262
mod <- compute_sequentially(
@@ -72,13 +72,13 @@ test_that("compute_sequentially works with preference data and tracing", {
7272

7373
expect_equal(length(mod$alpha_traces), 3)
7474
expect_equal(length(mod$alpha_traces[[2]]), 100)
75-
expect_gt(mod$alpha_traces[[2]][[3]], .04)
76-
expect_lt(mod$alpha_traces[[2]][[3]], .05)
75+
expect_gt(mod$alpha_traces[[2]][[3]], .4)
76+
expect_lt(mod$alpha_traces[[2]][[3]], .5)
7777

7878
expect_equal(length(mod$latent_rankings_traces), 3)
7979
expect_equal(length(mod$latent_rankings_traces[[2]]), 100)
8080
expect_equal(
8181
mod$latent_rankings_traces[[2]][[3]],
82-
c(1, 3, 5, 4, 2, 2, 1, 4, 3, 5)
82+
c(5, 4, 1, 3, 2, 5, 4, 2, 3, 1)
8383
)
8484
})

0 commit comments

Comments
 (0)