Added parallel likelihood computation#171
Conversation
…sing posterior approximations
|
@kdubovikov If you run the tests for loo subsample locally do they pass for you? It looks like we're getting a bunch of test failures when checking online but that may or may not be related to this PR (I haven't had a chance to investigate). |
Yes, tests are failing with NULL output which is strange. Will look into what their code when I’ll have the time |
|
Sure! I can review. @kdubovikov if tou check the failing error as a first syep that is great. I might be a little too defensive in the test suite, so that might be the reason. |
|
Tests were failing due to debug prints that I forgot to delete. Everything should be working well now. By the way, @MansMeg , an impressive test set 👍 |
|
Great! I will start to review it asap. |
MansMeg
left a comment
There was a problem hiding this comment.
I think this looks good. The only open question now is the documentation without a function.
A question is also if we can add a test to check that this works with cores > 1? I'm not sure this is a part of the test suite.
Codecov Report
@@ Coverage Diff @@
## master #171 +/- ##
=======================================
Coverage 95.15% 95.15%
=======================================
Files 28 28
Lines 2662 2664 +2
=======================================
+ Hits 2533 2535 +2
Misses 129 129
Continue to review full report at Codecov.
|
|
Alright. It seems that we do not have any tests for testing that multiple cores are working as expected. @jgabry do you have any way of testing multicore in any of the test suites? The additional part this is currently not tested are lines 495:503. It looks good to me, but I guess we would like to test multicore performance in the CI? |
…ate function as it was before
@MansMeg I have added |
|
I think we should avoid adding dependencies to the loo package as much as possible. Let's see what @jgabry say. We should conform to the way multicore stuff is tested currently in the package. The patrick package is version 0.0.3 and hence very unmature right now - so I would discourage using it altogether. |
|
It's ok to use up to 2 cores in tests on CRAN I believe. We don't have tests checking multicore speed, but we do have tests in other files that check whether the parallelized version and the non-parallelized version return the same answer. For example: loo/tests/testthat/test_loo_and_waic.R Lines 32 to 35 in 0117858 The If you do want to test that multicore is faster then comparing |
|
I think this definitely is sufficient, the main thing is that we want to check that we get the same reault with and without multicore on win and mac machines. I guess this will now be checked if we go with this solution? @kdubovikov is it ok for you to go with this solution instead of patrick? |
|
Ping @kdubovikov |
|
@MansMeg sorry, was occupied by work. Sure, it is ok for me to do it. I will update the code as soon as I will have the time |
|
Great! I think it would be very nice to get parallelism into the subsampling functionality. |
|
@MansMeg done, simplified tests and removed the dependency |
a5fb060 to
cd60a8e
Compare
|
I have now check this and I think it looks good! I'm happy to add this functionality and it makes a lot of sense. Although, I think it is best that you @jgabry do the merge to master. |
|
Although, there seems to be an error in the run of the code coverage in github actions. |
MansMeg
left a comment
There was a problem hiding this comment.
I think this looks good, except that there seem to be some problem with the code coverage github action code.
|
Forgot that this hadn't been merged yet! Merging now. |
Hi. I have added parallel likelihood computation to speedup
loo_subsamplewhen using posterior approximations based on this discussion https://discourse.mc-stan.org/t/problem-running-loo-subsample-with-variational-inference-and-cmdstanr/22506/18.CC @MansMeg