Skip to content

Change docstring to correctly specify the support for Categorical #2493

Merged
twiecki merged 1 commit intopymc-devs:masterfrom
Daniel-Nichol:minordocfix
Aug 11, 2017
Merged

Change docstring to correctly specify the support for Categorical #2493
twiecki merged 1 commit intopymc-devs:masterfrom
Daniel-Nichol:minordocfix

Conversation

@Daniel-Nichol
Copy link
Contributor

@Daniel-Nichol Daniel-Nichol commented Aug 10, 2017

The docstring for Categorical specifies the support as 1,2,...|p|, however this is incorrect and the actual support is 0,1,...,|p|-1. Note that

import pymc3 as pm
data = [1,2,3,4,5,6]
with pm.Model() as die_model:
    p = pm.Dirichlet('p', np.ones(6))
    d = pm.Categorical('d', p=p, observed=data)

Gives the error "index 6 is out of bounds for size 6", whereas

data = [0,1,2,3,4,5]
with pm.Model() as die_model:
    p = pm.Dirichlet('p', np.ones(6))
    d = pm.Categorical('d', p=p, observed=data)

works as intended.

@twiecki twiecki merged commit d5a011f into pymc-devs:master Aug 11, 2017
@twiecki
Copy link
Member

twiecki commented Aug 11, 2017

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants