Skip to content

logp of Bound distributions is wrong #1843

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

Closed
aseyboldt opened this issue Mar 1, 2017 · 6 comments
Closed

logp of Bound distributions is wrong #1843

aseyboldt opened this issue Mar 1, 2017 · 6 comments

Comments

@aseyboldt
Copy link
Member

aseyboldt commented Mar 1, 2017

This came up in #1833.
The logp function of Bounded returns the raw values of the underlying distribution, but it should correct those with the new normalization constant of the bounded distribution using the cdf and ccdf of the underlying distribution. In many cases this is just a constant, so the results of the samplers do not change, but if Bound is used as an observed var (to model truncated data for example), this can lead to wrong results. This should either me mentioned in the doc of Bound, and in this case it should probably refuse the observed keyword, or we would need to implement cdf and ccdfs for each distribution in pymc3.

@domenzain
Copy link
Contributor

The second alternative seems more natural to the users and provides much more modelling power out of the box.

@ColCarroll
Copy link
Member

ColCarroll commented Mar 1, 2017

I agree the second seems like the "right" answer, but it might be better for everyone to update the documentation and refuse the observed keyword for now and leave this issue open for someone to take up. It just seems like updating the docs is a ~30min exercise and the other would require some more careful work and testing.

@aseyboldt
Copy link
Member Author

We might also want to somehow keep the functionality of the current Bound around. This does seem useful when defining new distributions.
I think I have a bit of time to work on this sometime this week. I guess we don't need cdfs for all distributions for now.

@domenzain
Copy link
Contributor

If there is a place to gradually add cdfs, I can contribute a few of them too during the week.

@domenzain
Copy link
Contributor

Maybe this could be called Truncated. This way Bounded is kept around for other uses and the current code can stay as it is.

@aseyboldt
Copy link
Member Author

Closed by #1942, see #1864 for long term plan.

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

No branches or pull requests

3 participants