Skip to content

Don't allow Deterministics in the graph of observed #7769

Open
@ricardoV94

Description

@ricardoV94

Description

In #7656 we allow PyTensor deterministic operations in the graph of observed variables, but we probably don't want to allow PyMC determinstics. Doing that makes model cloning failing, for starters:

import pymc as pm

with pm.Model() as m:
    x_data = pm.Data("x_data", [0, 1, 2])
    y_data = pm.Deterministic("y", x_data + 1)
    y = pm.Normal("y", observed=y_data)

m.clone()  # ValueError: Variable name y already exists.

I am not sure about the implications of mixing the two, I suggest we be conservative and don't allow it for now, unless a good reason crops up. Also a Deterministic like this would be wastefully saved in every iteration of pm.sample!

CC @williambdean

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions