From c5207dd91c9c1b342b63f06fda3585b0b5423d50 Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Fri, 24 May 2019 09:45:50 -0500 Subject: [PATCH] Redo Data detection per @lucianopaz. @lucianopaz reports that Data items are instances of SharedVariable, and Deterministic are not. --- pymc3/data.py | 3 --- pymc3/model_graph.py | 14 ++++---------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/pymc3/data.py b/pymc3/data.py index 28b8131a46a..cac3b97ba3a 100644 --- a/pymc3/data.py +++ b/pymc3/data.py @@ -449,7 +449,4 @@ def __new__(self, name, value): "inside a 'with model:' block.") model.add_random_variable(shared_object) - # mark this as a data object - shared_object.is_data = True - return shared_object diff --git a/pymc3/model_graph.py b/pymc3/model_graph.py index 1a08c7b95ce..5b4954f36c6 100644 --- a/pymc3/model_graph.py +++ b/pymc3/model_graph.py @@ -103,17 +103,11 @@ def _make_node(self, var_name, graph): # Get name for node if hasattr(v, 'distribution'): distribution = v.distribution.__class__.__name__ + elif isinstance(v, SharedVariable): + distribution = 'Data' else: - is_data = False # type: bool - try: - is_data = v.is_data - except AttributeError: - pass - if is_data: - distribution = 'Data' - else: - distribution = 'Deterministic' - attrs['shape'] = 'box' + distribution = 'Deterministic' + attrs['shape'] = 'box' graph.node(var_name.replace(':', '&'), '{var_name} ~ {distribution}'.format(var_name=var_name, distribution=distribution),