Repository navigation
Conversation
|
Didn't put this in the issue, but should probably also see if test times can be dropped. I'm looking to see if parallelization would be worth it, initially it seems like one file dominates timings and should be split up. EDIT: cut times by half locally using 4 workers, should speed up CI a little too. I haven't looked through the test suite, but snapshots may be useful too. |
|
This is how benchmark results would change (along with a 95% confidence interval in relative change) if 4cf4511 is merged into master:
|
|
Thanks @mcol! @VisruthSK do you have time to review this? |
|
Yup, will take a proper look soon then. |
|
Thanks! |
VisruthSK
left a comment
There was a problem hiding this comment.
Looks great! I noted a few patterns where I'm being nitpicky and would prefer a change in how we're checking some things, the ignore_attr comment is the only serious one in that it weakens the assertion significantly enough that I think we should try to avoid that.
There are two places where I think snapshots make sense (though that could go in another PR): in the Pareto tests, and most of the rvar print tests. Both would be good to simplify the code and make updating messages easier.
| draws_matrix <- draws_matrix(a = 1:10, b = 11:20, c = 1) | ||
| draws_matrix2 <- as_draws_matrix(cbind(1:10, 11:20, 1)) | ||
| expect_equivalent(draws_matrix, draws_matrix2) | ||
| expect_equal(draws_matrix, draws_matrix2, ignore_attr = TRUE) |
There was a problem hiding this comment.
Could you check if we can weaken the ignore_attr bypass? I think ignore_attr = "cache" might suffice across the board.
There was a problem hiding this comment.
I now ignore only the specific attributes that are different. Ignoring "cache" is fine in a few cases, In most cases it's "dimnames", but there are also others ("dim", "names", "nchains") that crop up.
| w <- runif(ndraws(x), 0, 10) | ||
|
|
||
| x <- as_draws_matrix(x) | ||
| x_rs <- resample_draws(x, weights = w, method = "stratified") |
There was a problem hiding this comment.
I think suppressing the messages is good since it cleans up test run logs, but maybe we could try something like
# Store and restore option to ensure test isolation
old_option <- getOption("posterior.warn_on_merge_chains")
on.exit(options(posterior.warn_on_merge_chains = old_option))
options(posterior.warn_on_merge_chains = TRUE)which is already used elsewhere? We could write a tiny helper or even add withr since its a transitive dep anyway.
There was a problem hiding this comment.
I used the existing pattern.
| expect_equal(pareto_khat(tau_chains, ndraws_tail = 20), | ||
| pareto_khat(tau_nochains, ndraws_tail = 20)) | ||
|
|
||
| suppressMessages({ |
There was a problem hiding this comment.
Wouldn't verbose = FALSE work here instead of explicit suppression? I think that's cleaner.
|
Made a few tiny fixes, if its all green on the rerun, should be okay to merge. |
Summary
This replaces uses of deprecated
expect_is()andexpected_equivalent(). Messages were automatically suppressed in 2e, but need to be manually suppressed (or captured withexpect_message()) under 3.Changes like the following:
are used to avoid the "Dropping 'draws_df' class as required metadata was removed" warnings.
Also runs tests in parallel.
Fixes #458.
Copyright and Licensing
By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the following licenses: