Distributions.jl
Distributions.jl copied to clipboard
Add `pdf(_, missing)` and `logpdf(_, missing)`
closes #1392.
Codecov Report
Patch coverage: 100.00% and no project coverage change
Comparison is base (
eecfd3c) 85.81% compared to head (9af9c09) 85.82%.
Additional details and impacted files
@@ Coverage Diff @@
## master #1688 +/- ##
=======================================
Coverage 85.81% 85.82%
=======================================
Files 131 137 +6
Lines 8314 8318 +4
=======================================
+ Hits 7135 7139 +4
Misses 1179 1179
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/common.jl | 81.18% <100.00%> (+0.38%) |
:arrow_up: |
| src/univariates.jl | 74.66% <100.00%> (+0.11%) |
:arrow_up: |
| src/eachvariate.jl | 85.71% <0.00%> (-4.77%) |
:arrow_down: |
| src/multivariate/dirichlet.jl | 73.30% <0.00%> (-4.62%) |
:arrow_down: |
| src/univariate/discrete/negativebinomial.jl | 90.74% <0.00%> (-2.69%) |
:arrow_down: |
| src/univariate/continuous/uniform.jl | 95.00% <0.00%> (-1.00%) |
:arrow_down: |
| src/univariate/discrete/poissonbinomial.jl | 93.07% <0.00%> (-0.63%) |
:arrow_down: |
| src/utils.jl | 95.58% <0.00%> (ø) |
|
| src/density_interface.jl | ||
| ...ulesCoreExt/univariate/discrete/poissonbinomial.jl | 100.00% <0.00%> (ø) |
|
| ... and 6 more |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
Thank you for the PR!
Unfortunately, in my opinion it should not be merged in its current form.
More generally, I think #1392 needs more thought and discussion. In my opinion, it is a design problem of
Missingthat somehow people now expect every method to supportmissing(just check how many open issues there are in Statistics stdlib about handling missing values). So I'm not excited about it, but I would be fine with addingpdf(d::Distribution, x::Missing) = missingirrespective of these deficiencies, given how widespread implementations withmissinghave become.However, I don't see a compelling reason to add
pdf(d::Missing, x::Real)or similar.x::Missingcorresponds to missing data but in what situations would one encounter amissingdistribution?Another point is: Why should one only handle
logpdf?cdf? etc.In addition to these general concerns, I think there are some other problems with this PR:
.DS_Storeshould not be addedx::Anyis too generic, IMO a method forx::Missingis sufficient- The definition creates a stackoverflow if neither
dnorxaremissing- More tests should be added
Thank you for the review however for the second point, pdf(missing, x) was requested as well. If we just use x::Missing, it will again give a method error. But I agree that there's a very minimal chance of it happening. I will look into points 4 and 5.
however for the second point, pdf(missing, x) was requested as well.
Not every feature request is uncontroversial and should be implemented :slightly_smiling_face: