sktime / skpro

A unified framework for tabular probabilistic regression, time-to-event prediction, and probability distributions in python
https://skpro.readthedocs.io/en/latest
BSD 3-Clause "New" or "Revised" License
250 stars 46 forks source link

[BUG] `plot` method of the `Binomial` distribution shows incorrect pmf. #416

Open meraldoantonio opened 5 months ago

meraldoantonio commented 5 months ago

Describe the bug The plot method of the Binomial distribution shows incorrect pmf.

To Reproduce

from skpro.distributions import Binomial
n = Binomial(n=10, p=0.5)
n.plot('pmf')
image

Expected behavior The plot.("pmf") should show the correct Binomial plot, which looks like this: image

Additional context - comments by @fkiraly from #415 Currently, the plotting function samples a grid of x points, plots x, f(x) for the function and connects them. If the grid does not hit the mass points, the plot will look like this.

The only way to have the correct plot always is to know where the support is. That is currenty not inspectable from the object, and that's why I wanted the sets symbolism from https://github.com/sktime/skpro/issues/244.

This bug is also referenced in #415