Skip to content

Commit

Permalink
Redo Data detection per @lucianopaz.
Browse files Browse the repository at this point in the history
@lucianopaz reports that Data items are instances of SharedVariable, and Deterministic are not.
  • Loading branch information
rpgoldman committed May 24, 2019
1 parent d06cfc6 commit c5207dd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
3 changes: 0 additions & 3 deletions pymc3/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 4 additions & 10 deletions pymc3/model_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit c5207dd

Please sign in to comment.