Skip to content

with_data doesn't recognize shared variables when the compiled model has a name #136

Description

@a2435191

I figured out that you have to prefix the model name followed by two colons when updating variables in the with_data keyword arguments. I don't know if this is intended, but I thought I would raise this issue so that other people can search for it.

import pymc as pm
import nutpie

with pm.Model("a good name") as my_model:
    n = pm.Data("n", 1)
    pm.Binomial("my_var", n=n, p=0.7, observed=n.eval()/2)

compiled = nutpie.compile_pymc_model(model)
compiled.with_data(updates={'a good name::n', 15}) # works
compiled.with_data(n=15) # throws KeyError: 'Unknown shared variable: updates'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions