-
Notifications
You must be signed in to change notification settings - Fork 0
Tests for importance sample creation #100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
swinter1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
One optional thing - Do we want to address this TODO while we are here? "num_samples_total; this should probably define the number of samples to return, and then continue generating them" - I think this would be pretty quick to do?
I had that in a separate issue but I agree it makes sense to include it now. |
done |
|
Note: the docstring in importance_sampling.py will be improved in PR 123. |
….com/dnv-opensource/axtreme into 97_test_importance_sampling_creation
am-kaiser
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great! I only had one comment
| mask = pdf > threshold | ||
| samples = samples[mask] | ||
| while samples_collected < num_samples_total: | ||
| # Draw a batch of proposals |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You run into the danger of having an infinite loop here, i.e. if env_distribution_pdf never returns values > threshold you’ll loop forever. Suggested solution: add a max proposals/trials limit and raise a clear error if nothing is accepted.
Main issue:
Closes #97
Sub issues: