Skip to content

Categorical distribution bound not enforced early enough #1093

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
fonnesbeck opened this issue May 13, 2016 · 3 comments
Closed

Categorical distribution bound not enforced early enough #1093

fonnesbeck opened this issue May 13, 2016 · 3 comments

Comments

@fonnesbeck
Copy link
Member

In the logp for the categorical distribution, the method rightly bounds the value at the appropriate index limits for the vector of probabilities, However, since the log-probability is calculated before the bound is checked, you can still get an IndexError. Unfortunately, Theano breaks the usual exception handling for this.

@srlindsay
Copy link

Is it sufficient to just mod by k to avoid the index error and allow the bound to handle the invalid value?

e.g. a = T.log(p[value % k])

@twiecki
Copy link
Member

twiecki commented May 20, 2016

@srlindsay I think that would hide useful model errors.

@fonnesbeck Seems like bounds should always be checked before evaluation, can bound() be rewritten to do so?

@twiecki
Copy link
Member

twiecki commented Feb 28, 2019

Closed by #3386.

@twiecki twiecki closed this as completed Feb 28, 2019
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