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

Allow censoring Categorical distributions #7662

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ricardoV94
Copy link
Member

@ricardoV94 ricardoV94 commented Jan 28, 2025

Copy link

codecov bot commented Jan 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.71%. Comparing base (fa43eba) to head (60c763f).
Report is 4 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #7662      +/-   ##
==========================================
- Coverage   92.78%   92.71%   -0.08%     
==========================================
  Files         107      107              
  Lines       18196    18400     +204     
==========================================
+ Hits        16884    17059     +175     
- Misses       1312     1341      +29     
Files with missing lines Coverage Δ
pymc/distributions/discrete.py 99.42% <100.00%> (+0.01%) ⬆️

... and 8 files with indirect coverage changes

Copy link
Member

@jessegrabowski jessegrabowski left a comment

Choose a reason for hiding this comment

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

Add a test for the logcdf?

res = pt.switch(
def logp(value, p):
k = pt.shape(p)[-1]
value, safe_value_p = Categorical._safe_index_value_p(value, p)
Copy link
Member

Choose a reason for hiding this comment

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

I don't love making _safe_index_value_p a method. What's the conceptual advantage vs just being a function?

Copy link
Member Author

Choose a reason for hiding this comment

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

doesn't clutter the namespace, that's the only difference

@ricardoV94
Copy link
Member Author

Add a test for the logcdf?

I did... it's in the Censored. Since there is no Categorical scipy distribution, I would just be comparing two implementations written by me?

@ricardoV94
Copy link
Member Author

Ah, I tested the logp... hmm okay okay

@ricardoV94 ricardoV94 marked this pull request as draft January 28, 2025 15:41
@ricardoV94 ricardoV94 marked this pull request as ready for review January 30, 2025 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants