A newbie question PyMC3 in a notebook

In one of the notebooks…I am defining a stochastic variable as

data = np.array([10, 5])
with model:
    fixed_variable = pm.Poisson("fxd", 1, observed=data)

Later I discover that I do not need this variable…how do I delete it in a notebook (in the context of the model)?
Can I redefine “fxd” as a different variable say random.exponential (either in the same cell or in a subsequent cell)?

I keep getting name fxd already exists kind of message.

Thanks in advance

1 Like

Hi @sam, good question, I dont think there is an easy way to remove a variable from a pm.Model. As far as I can tell there is no easy way to remove a node from a graph in theano.

@junpenglao
It looks like theano is lazy at evaluation but assigns variable names within allocated memory (cpu or gpu) as soon as they are declared.

In the past I had written python scripts and used theano but never run a notebook step by step or cell by cell.

This was good learning.

Thank you for your response. Let’s all explore if there is a way :smile:

1 Like