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

Refactor Flat and HalfFlat distributions #4723

Merged
merged 3 commits into from
May 30, 2021
Merged

Conversation

ricardoV94
Copy link
Member

Replaced ValueError by NotImplementedError.

Also cleaned some tests that had wrong pytest.marks or were redundant.

Depending on what your PR does, here are a few things you might want to address in the description:

@ricardoV94 ricardoV94 added the v4 label May 26, 2021
@ricardoV94 ricardoV94 added this to the vNext (4.0.0) milestone May 26, 2021
@ricardoV94 ricardoV94 mentioned this pull request May 26, 2021
26 tasks
@ricardoV94 ricardoV94 force-pushed the flat_dist branch 2 times, most recently from 5ca23ab to f950baa Compare May 27, 2021 08:06
Copy link
Contributor

@brandonwillard brandonwillard left a comment

Choose a reason for hiding this comment

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

I still question the purpose/place of these Flat distributions (and, now, RandomVariables); however, this PR looks fine.

At some point, we need to revisit these and determine whether or not they're still needed or relevant given the new framework (or a potentially newer one).

Comment on lines +336 to +337
if testval is None:
testval = np.full(size, floatX(0.0))
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm assuming these test values were necessary because, when aesara.config.compute_test_value is enabled, RandomVariable.perform is called in order to generate a test value automatically, and it will fail.

In general, test value-related logic like this needs to be conditioned on aesara.config.compute_test_value != "off"; otherwise, we'll end up doing unnecessary work. This case might be different, though.

Copy link
Member Author

@ricardoV94 ricardoV94 May 29, 2021

Choose a reason for hiding this comment

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

The Flat testval is critical (in the codebase) in a couple of places (e.g., for getting the model.initial_point for sampling).

Copy link
Contributor

@brandonwillard brandonwillard May 29, 2021

Choose a reason for hiding this comment

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

Just keep in mind that v4 cannot actually require test values, and anywhere that currently does is a place we need to refactor.

Aside from that, it should always be possible to enable test values and have them work throughout v4, it's just not mandatory or automatically enabled at any point within PyMC.

Copy link
Member Author

Choose a reason for hiding this comment

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

Definitely, I am adding a note about this in #4567

@ricardoV94 ricardoV94 merged commit d95827f into pymc-devs:v4 May 30, 2021
twiecki pushed a commit that referenced this pull request Jun 5, 2021
* Refactor Flat and HalfFlat distributions

* Re-enable Gumbel logp test

* Remove redundant test
@ricardoV94 ricardoV94 deleted the flat_dist branch June 7, 2021 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants