Skip to content

Issue with recent initval changes #4737

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
ricardoV94 opened this issue Jun 4, 2021 · 2 comments · Fixed by #4738
Closed

Issue with recent initval changes #4737

ricardoV94 opened this issue Jun 4, 2021 · 2 comments · Fixed by #4738
Assignees
Labels

Comments

@ricardoV94
Copy link
Member

ricardoV94 commented Jun 4, 2021

I found some issues with the recent initval changes in #4729, as it doesn't respect the parents initvals.

This snippet often leads to a ValueError:

with pm.Model() as model:
    mu = pm.Normal('mu', initval=100)
    alpha = pm.HalfNormal('alpha', initval=100, transform=None)
    value = pm.NegativeBinomial('value', mu=mu, alpha=alpha)

model.initial_values
# {mu: array(100., dtype=float32),
#  alpha: array(100., dtype=float32),
#  value: array(1)}

When it doesn't fail, initval is still far from the expected ~ 100:

pm.NegativeBinomial.dist(mu=100, alpha=100).eval()
# array(98)

Originally posted by @ricardoV94 in #4734 (comment)

@ricardoV94
Copy link
Member Author

ricardoV94 commented Jun 4, 2021

Also a model where pm.Flat is used as input will now raise an error unless an initval is set for those variables:

with pm.Model() as m:
    x = pm.Flat('x')
    y = pm.Normal('y', x, 1)    
NotImplementedError: Cannot sample from flat variable

@michaelosthege
Copy link
Member

closed by #4738

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants