Skip to content
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

Improve predictive samples #95

Merged
merged 3 commits into from
Apr 11, 2022
Merged

Improve predictive samples #95

merged 3 commits into from
Apr 11, 2022

Conversation

aleximmer
Copy link
Owner

Addresses #93 and #91 with following changes:

@aleximmer aleximmer requested a review from runame April 4, 2022 19:27
@runame runame added the enhancement New feature or request label Apr 5, 2022
Copy link
Collaborator

@runame runame 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 to me! See comments below for nit questions.

@@ -525,6 +534,10 @@ def __call__(self, x, pred_type='glm', link_approx='probit', n_samples=100):

if link_approx not in ['mc', 'probit', 'bridge']:
raise ValueError(f'Unsupported link approximation {link_approx}.')

if generator is not None:
if type(generator) is not torch.Generator or generator.device != x.device:
Copy link
Collaborator

@runame runame Apr 9, 2022

Choose a reason for hiding this comment

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

Why not just use not isinstance(generator, torch.Generator)?



def test_diagonal_normal_samples():
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it possible to test against torch Normal/MultivariateNormal samples by using the same generator state or is the implementation not the same?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Checked it, unfortunately not. But the statistics match when taking many samples.

@aleximmer aleximmer merged commit 92c2949 into main Apr 11, 2022
@aleximmer aleximmer deleted the improved-predictive branch April 11, 2022 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants