Removing unnecessary `comp_shape` from class NormalMixture
This modification assumes that the Mixture class automatically handles the reshaping of component batch dimensions, and there is no longer a need to explicitly specify the comp_shape
Description
Related Issue
- [x] Closes #6986
Checklist
- [ ] Checked that the pre-commit linting/style checks pass
- [ ] Included tests that prove the fix is effective or that the new feature works
- [ ] Added necessary documentation (docstrings and/or example notebooks)
- [ ] If you are a pro: each commit corresponds to a relevant logical change
Type of change
- [ ] New feature / enhancement
- [ ] Bug fix
- [ ] Documentation
- [x] Maintenance
- [ ] Other (please specify):
π Documentation preview π: https://pymc--7098.org.readthedocs.build/en/7098/
Thanks @mohammed052, running that tests and we can merge if everything passes
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 92.29%. Comparing base (
a033261) to head (aa602ec).
:exclamation: Current head aa602ec differs from pull request most recent head b6eeec8. Consider uploading reports for the commit b6eeec8 to get more accurate results
Additional details and impacted files
@@ Coverage Diff @@
## main #7098 +/- ##
=======================================
Coverage 92.29% 92.29%
=======================================
Files 100 100
Lines 16875 16875
=======================================
Hits 15575 15575
Misses 1300 1300
| Files | Coverage Ξ | |
|---|---|---|
| pymc/distributions/mixture.py | 95.08% <100.00%> (ΓΈ) |
@mohammed052 you can see here some tests failed because they were still using the removed keyword: https://github.com/pymc-devs/pymc/actions/runs/7492576052/job/20484268751?pr=7098
We need to tweak the tests to not use it, but keep the same behavior otherwise.
@ricardoV94 can you please elaborate on what needs to be done next to tweak the tests
@mohammed052 you'll need to investigate yourself, and for that it may be useful to run the tests locally to see what they are doing
I was facing difficulty earlier in identifying the problem in tests.Thank You @larryshamalama for your input. I have made required changes in test_mixture.py. @ricardoV94 kindly review them.
Thanks for the changes
I was facing difficulty earlier in identifying the problem in tests.Thank You @larryshamalama for your input. I have made required changes in test_mixture.py. @ricardoV94 kindly review them.
There seems to be a lot more tests in test_mixture.py that has comp_shape as an argument, e.g. test_normal_mixture_nd. To be more time efficient, I can't identify every instance where these tests need modifications; there seem to be more. However, akin to my previous comment, the edits should be very similar.
I made a few more changes last week, @ricardoV94 @larryshamalama can you now review the pull request once.
@mohammed052 you need to run pre-commit
diff --git a/tests/distributions/test_mixture.py b/tests/distributions/test_mixture.py
index ec1baa7..7ce6084 100644
--- a/tests/distributions/test_mixture.py
+++ b/tests/distributions/test_mixture.py
@@ -821,9 +821,7 @@ class TestNormalMixture:
taus = Gamma("taus", alpha=1, beta=1, shape=comp_shape)
ws = Dirichlet("ws", np.ones(ncomp), shape=(ncomp,))
mixture0 = NormalMixture("m", w=ws, mu=mus, tau=taus, shape=nd)
- obs0 = NormalMixture(
- "obs", w=ws, mu=mus, tau=taus, observed=observed
- )
+ obs0 = NormalMixture("obs", w=ws, mu=mus, tau=taus, observed=observed)
with Model() as model1:
I was the one rebasing this PR
]
Congrats on merging your first pull request! :tada: We here at PyMC are proud of you! :sparkling_heart: Thank you so much for your contribution :gift: