Skip to content

Adding check to prevent mixing of discrete and continuous distributions #5629

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

Merged
merged 10 commits into from
Apr 4, 2022

Conversation

larryshamalama
Copy link
Member

@larryshamalama larryshamalama commented Mar 20, 2022

Closes #4511. all_discrete in mixture.py has also been removed

Is there a test that should be added?

@codecov
Copy link

codecov bot commented Mar 20, 2022

Codecov Report

Merging #5629 (bbee4cf) into main (f1bd401) will increase coverage by 0.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5629      +/-   ##
==========================================
+ Coverage   88.82%   88.86%   +0.04%     
==========================================
  Files          75       75              
  Lines       13736    13737       +1     
==========================================
+ Hits        12201    12208       +7     
+ Misses       1535     1529       -6     
Impacted Files Coverage Δ
pymc/distributions/mixture.py 97.08% <100.00%> (+1.47%) ⬆️
pymc/parallel_sampling.py 87.70% <0.00%> (+0.99%) ⬆️

@ricardoV94
Copy link
Member

Is there a test that should be added?

Always!

@larryshamalama
Copy link
Member Author

Is there a test that should be added?

Always!

Can you share a quick pointer on how to catch errors?

@ricardoV94
Copy link
Member

Is there a test that should be added?

Always!

Can you share a quick pointer on how to catch errors?

Usually with with pytest.raises(ExpectedError, match="expected error string"): ...

There are a bunch of examples in the codebase, here is just a random one:

with pytest.raises(ShapeError, match="must be ≤1-dimensional"):
change_rv_size(rv, new_size=[[2, 3]])

Copy link
Member

@ricardoV94 ricardoV94 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 left some minor suggestions

@ricardoV94 ricardoV94 merged commit eb8d12b into pymc-devs:main Apr 4, 2022
@ricardoV94
Copy link
Member

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mixture should not allow mixing of discrete and continuous distributions
2 participants