Skip to content
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

Forward sampling returning an empty dictionary #97

Closed
Adarsh-kumar opened this issue Mar 29, 2019 · 1 comment
Closed

Forward sampling returning an empty dictionary #97

Adarsh-kumar opened this issue Mar 29, 2019 · 1 comment

Comments

@Adarsh-kumar
Copy link

Adarsh-kumar commented Mar 29, 2019

I am trying a forward sampling on mixture model example from pymc4 examples, but getting an empty dict as a result.

The model is defined as -

@pm.model
def mixture(n_groups, n_points):    
    centers = pm.Normal('centers', loc=tf.zeros((n_groups, 2)), scale=1)
    scales = pm.HalfNormal('scales', 0.4 * tf.ones(n_groups))
    rates = pm.Dirichlet('rates', concentration=tf.ones(n_groups))
    
    group_assignments = pm.Multinomial('group_assignments', total_count=n_points, probs=rates)
    
    for idx in range(n_groups):
        count = tf.to_int32(group_assignments[idx])
        pm.Normal(f'group_{idx}', loc=centers[idx] * tf.ones((count, 2)), scale=scales[idx])

# Now I configured the model -
model = mixture.configure(n_groups=5, n_points=10_000)

I checked the tensorflow graph but it's not empty. The graph node names are-
['zeros',
'centers/scale',
'centers/Identity',
'centers/Identity_1',
'ones/shape_as_tensor',
'ones/Const',
'ones',
'mul/x',
'mul',
'scales/scale',............]

What could be the reasons ?

@lucianopaz
Copy link
Contributor

Closing as this relates to the old context based API. It would be nice to check out this example in the current coroutine API though

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

2 participants