Skip to content

Conversation

@am-kaiser
Copy link
Collaborator

@am-kaiser am-kaiser commented Jul 14, 2025

@am-kaiser am-kaiser requested a review from swinter1 July 14, 2025 12:44
@am-kaiser am-kaiser marked this pull request as ready for review July 14, 2025 12:54
Copy link
Collaborator

@swinter1 swinter1 left a 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?

@am-kaiser
Copy link
Collaborator Author

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.

@am-kaiser
Copy link
Collaborator Author

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

@am-kaiser
Copy link
Collaborator Author

Note: the docstring in importance_sampling.py will be improved in PR 123.

Copy link
Collaborator Author

@am-kaiser am-kaiser 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! I only had one comment

mask = pdf > threshold
samples = samples[mask]
while samples_collected < num_samples_total:
# Draw a batch of proposals
Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants