-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Deprecate remaining VI methods #5642
Conversation
Codecov Report
@@ Coverage Diff @@
## main #5642 +/- ##
==========================================
- Coverage 89.36% 82.04% -7.33%
==========================================
Files 74 73 -1
Lines 13805 13152 -653
==========================================
- Hits 12337 10790 -1547
- Misses 1468 2362 +894
|
I need some help with the next step; is adding a deprecation warning the right way to go? |
I think the idea was to just remove them (even though the title in the issue says "deprecate"). The methods are not implemented in v4, so there is really nothing to deprecate. |
Could someone please help me remove the Normalizing flows? pymc/pymc/variational/approximations.py Lines 362 to 364 in ef5f91b
|
@ferrine would you like to take a look here? |
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.
As for normalizing flows I expect something like rm pymc/variational/flows.py
as a good first step
pymc/variational/approximations.py
Outdated
@@ -270,14 +272,14 @@ def _new_initial(self, size, deterministic, more_replacements=None): | |||
at.repeat(self.mean.reshape((1, -1)), size, -1), | |||
self.histogram[self.randidx(size)], | |||
) | |||
elif deterministic: | |||
warnings.warn( | |||
"Deterministic sampling from a Histogram is deprecated and will be removed soon.", |
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.
Is it indeed broken or it was a false alarm?
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.
We can enable the test for that and check
pymc/variational/opvi.py
Outdated
@@ -957,9 +957,9 @@ def __init_group__(self, group): | |||
if not group: | |||
raise GroupError("Got empty group") | |||
if self.local: |
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.
I think the context of the issue was to entirely delete the code and local
kwarg, feel free to just delete large portions of the code.
pymc/variational/opvi.py
Outdated
@@ -957,9 +957,9 @@ def __init_group__(self, group): | |||
if not group: | |||
raise GroupError("Got empty group") | |||
if self.local: | |||
raise NotImplementedInference("Local inferene aka AEVB is not supported in v4") | |||
warnings.warn("Local inferene aka AEVB is deprecated.", DeprecationWarning) | |||
if self.batched: |
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.
Same for batched
kwarg and all its mentions. Just delete without hesitation
Is this enough to go on @purna135 ? |
I'll work on these suggestions and let you know if I need anything else. |
Hi @purna135, this PR is one of the final steps towards |
Hi @michaelosthege sorry for the delay; I was preoccupied with my exam, which has now been done. |
pymc/variational/opvi.py
Outdated
@@ -957,9 +957,9 @@ def __init_group__(self, group): | |||
if not group: | |||
raise GroupError("Got empty group") | |||
if self.local: | |||
raise NotImplementedInference("Local inferene aka AEVB is not supported in v4") | |||
warnings.warn("Local inferene aka AEVB is deprecated.", DeprecationWarning) |
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.
We should just delete this code, rather than deprecate.
473e28e
to
66c1786
Compare
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 to me, can be merged once tests pass
Thank you very much, @ferrine. Could you kindly advise me on how to pass these failed tests? |
@purna135, the tests diff was collapsed. I think I missed something here. I have to go through it once more |
(not_raises(), {MeanFieldGroup: ["one"], FullRankGroup: ["two", "three"]}), | ||
], | ||
) | ||
@ignore_not_implemented_inference |
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.
the ignore_not_implemented_inference
hook was used to ignore tests that fail due to the not supported functionality.
NotImplementedInference
is an explicit error not to confuse failures with other "bugs". Most of the tests that are deleted so far are valid tests.
The commit that deletes all these tests should be reverted. Or, if not easy, you can use the original file that is present in master.
To summarise.
- The only obsolete thing in the test file is
ignore_not_implemented_inference
. - Once it is removed, all tests should pass and no
NotImplementedInference
is raised. - The only tests to remove are that fail because of the removed functionality.
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.
I missed the collapsed diff of tests. Most of the deleted tests are valid. I've left a comment above with the explanation.
We did a quick video chat with @purna135 to avoid further confusion. Additional thing to revisit was the documentation. That missed my eye as well. |
Thank you so much for your time and help @ferrine : ) |
Hello, @ferrine. I deleted several flow-related tests and refactored others, but there are still 10 tests that I am unable to refactor and have commented so that other tests can be checked. Could you please assist me in refactoring the tests I commented? |
Addressing #5581
Replaced remaining NotImplementedInference methods with deprecation warning.