modify summarise_draws internals not to coerce values to same type#356
modify summarise_draws internals not to coerce values to same type#356n-kall wants to merge 5 commits intostan-dev:masterfrom
Conversation
|
This is how benchmark results would change (along with a 95% confidence interval in relative change) if eca0fae is merged into master:
|
|
Looks like a >1% increase to |
|
How much increase exactly? 1% would barely matter I think |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #356 +/- ##
=======================================
Coverage 95.33% 95.33%
=======================================
Files 50 50
Lines 3855 3860 +5
=======================================
+ Hits 3675 3680 +5
Misses 180 180 ☔ View full report in Codecov by Sentry. |
Based on these ^ |
|
This is how benchmark results would change (along with a 95% confidence interval in relative change) if a28483f is merged into master:
|
|
I've now added tests checking that the column types are as expected, and if the speed is ok, this is ready for review |
|
FWIW, I think the unnesting / flattening might be doable as a cbind on row vectors (or maybe vec_cbind / vec_rbind for safety) to create a 1-row data frame. Dunno if that helps at all. |
|
This is how benchmark results would change (along with a 95% confidence interval in relative change) if e175ba8 is merged into master:
|
|
Speed is okay. Still, is this already the best way to implement the flattening? |
Thanks for the tip! Simplifying this unnesting/flattening would, I think, be beneficial. However, I can't quite get the right structure with create_summary_list(example_draws(), 3, list(rhat = rhat_basic, quantile2 = quantile2), NULL) |>
vec_rbind()
## rhat quantile2
## 1 1.014967 -1.231353, 18.874003
create_summary_list(example_draws(), 3, list(rhat = rhat_basic, quantile2 = quantile2), NULL) |>
unlist()
## rhat quantile2.q5 quantile2.q95
## 1.014967 -1.231353 18.874003 |
|
Ah right... you might be able to use cbind if you conditionally transpose (or rbind) vectors of length > 1 to turn them into row vectors (not on a computer atm so I can't try it) |
I don't think the issue is so critical that the fix is needed right away, so perhaps it's better to leave this open in case some other ideas come up (e.g. if @mjskay's method works out). However, I won't spend more time on this now |
|
@paul-buerkner as discussed, I modified this PR to use |
Summary
This would fix #355.
As it is affecting
summarise_draws, which is one of the main functions inposterior, I think this change needs to be considered carefully. It might be less efficient than currently implemented, so I am opening this PR now to check how the benchmarks forsummarise_drawsperform.Copyright and Licensing
By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the following licenses: