Skip to content

Add a forward-only task to sbibm#19

Closed
psteinb wants to merge 44 commits intosbi-benchmark:mainfrom
psteinb:forward-only-task
Closed

Add a forward-only task to sbibm#19
psteinb wants to merge 44 commits intosbi-benchmark:mainfrom
psteinb:forward-only-task

Conversation

@psteinb
Copy link
Copy Markdown
Contributor

@psteinb psteinb commented Oct 1, 2021

this PR paves the way to allow users to add simulations without a reference posterior. This way, (I hope) it becomes easier for users to test drive and benchmark sbi for their use case even.

Closes #19

@psteinb
Copy link
Copy Markdown
Contributor Author

psteinb commented Oct 1, 2021

I am not yet 100% happy with the naming scheme. I also observed that no tasks appear to have unit tests.

@jan-matthis
Copy link
Copy Markdown
Contributor

Thanks for starting off a PR! Perhaps it would be best to have a general unit tests that checks all tasks in the same way and consider more specific ones on a per-task basis?

@psteinb
Copy link
Copy Markdown
Contributor Author

psteinb commented Nov 2, 2021

  • added a very general test suite for two_moons (a starting point for more perhaps)
  • finished norefposterior implementation for the time being
  • add unit tests to illustrate usage limitations

@psteinb
Copy link
Copy Markdown
Contributor Author

psteinb commented Nov 3, 2021

The code is pretty much done at this point. the simulate step for norefposterior turns out to be quite slow. I am not a pyro expert and hence need to check at some later point in time, what the root cause of this might be.

@jan-matthis please review.

@psteinb psteinb marked this pull request as ready for review November 3, 2021 16:54
- the covariance matrix for MultivariateNormal is constructed in such a
fashion, that it cannot be anything else than positive semi-definite

- keeping `validate_args=True` produced a tremendous slowdown (4x and more)
@psteinb
Copy link
Copy Markdown
Contributor Author

psteinb commented Nov 4, 2021

alright, this PR is ready to go from my side. Studying the other tasks, I see that my application tends to be somewhat special as I simulate an entire dense representation. So I am happy to receive any feedback on that.

I'll check now, how to obtain benchmark results on this task.

@psteinb psteinb mentioned this pull request Nov 4, 2021
@jan-matthis
Copy link
Copy Markdown
Contributor

Great, I will review it tomorrow

Copy link
Copy Markdown
Contributor

@jan-matthis jan-matthis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some first comments on the PR

@@ -0,0 +1,402 @@
import numpy as np
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Can we factor some of these tests out into a separate PR that adds generic tests for all tasks?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make a concrete proposal?
My suggestion: I am happy to send another PR for test_two_moons.py while keeping test_norefposterior.py.
What do you think?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will hopefully have time to work on the tests and #23 tomorrow, or Wednesday latest, and make a concrete proposal then. Cheers

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cheers for opening #29 -- I'd suggest we parametrize those tests to run for all tasks, that's what I had in mind when I asked about "generic tests" above

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I propose to merge this first and then adopt it in #29 or a subsequent PR.

@psteinb psteinb mentioned this pull request Nov 9, 2021
@jan-matthis jan-matthis linked an issue Nov 10, 2021 that may be closed by this pull request
@jan-matthis
Copy link
Copy Markdown
Contributor

jan-matthis commented Nov 10, 2021

Could you rebase on main for the next round of reviews?

@psteinb
Copy link
Copy Markdown
Contributor Author

psteinb commented Nov 10, 2021

huh, I thought I did so last night. Let me check.

@psteinb
Copy link
Copy Markdown
Contributor Author

psteinb commented Nov 10, 2021

Done, I hope.

Copy link
Copy Markdown
Contributor

@jan-matthis jan-matthis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great overall, only a few comments

@psteinb psteinb force-pushed the forward-only-task branch 2 times, most recently from d5ef8a5 to 365ee41 Compare November 11, 2021 10:25
@psteinb
Copy link
Copy Markdown
Contributor Author

psteinb commented Nov 11, 2021

Sorry folks, I hand-cuffed myself by using git rebase in a wrong fashion. I undid my rebase from earlier now (using cherry-pick) and repeated the exercise.

@psteinb
Copy link
Copy Markdown
Contributor Author

psteinb commented Nov 11, 2021

I hope I have addressed all comments now. Sorry for the mess with the accidental rebase.

@jan-matthis
Copy link
Copy Markdown
Contributor

No worries at all -- unfortunately, I think something is not quite right yet: Currently the PR still contains changes are on the main branch already

@psteinb
Copy link
Copy Markdown
Contributor Author

psteinb commented Nov 11, 2021

Not sure what you mean. github says this PR has no conflicts. I just did a manual git merge upstream main ... what am I missing?

@jan-matthis
Copy link
Copy Markdown
Contributor

jan-matthis commented Nov 11, 2021

I think you resolved the issue with commit b876c91 above. All looks good now!

I assume this is ready to be merged then -- or should we rather do #29 first? 🎉

@psteinb
Copy link
Copy Markdown
Contributor Author

psteinb commented Nov 12, 2021

Let's wait for #29 to be merged first. Then I will close this PR, split the code according to #29 and resubmit a new PR. One merit of this is also, that this very long conversation gets squashed into a handful of commits. Feel free to disagree.

Quite frankly: I'd love to get on with stuff and start running experiments.

@jan-matthis
Copy link
Copy Markdown
Contributor

jan-matthis commented Nov 12, 2021

#29 is merged -- so only this one is left -- almost done

@jan-matthis
Copy link
Copy Markdown
Contributor

Let's wait for #29 to be merged first. Then I will close this PR, split the code according to #29 and resubmit a new PR. One merit of this is also, that this very long conversation gets squashed into a handful of commits. Feel free to disagree.

Sounds good to me!

@psteinb
Copy link
Copy Markdown
Contributor Author

psteinb commented Nov 12, 2021

closed in favor of #34
Thanks to @jan-matthis and @janfb for all your valuable feedback

@psteinb psteinb closed this Nov 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Adding a forward-only task

3 participants