From f11317838b3afab3ebff245d9a83025e9d2e851b Mon Sep 17 00:00:00 2001 From: Jeroen Date: Wed, 20 Mar 2019 19:34:50 +0100 Subject: [PATCH] Fixed bug in drawing of graphviz edges from interaction nodes by replacing colons in node names with ampersands. (#3414) Ampersands are a safe replacement: they will not cause accidental node name collisions because they aren't allowed in python names (nor, by extension, in patsy formulas). --- pymc3/model_graph.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pymc3/model_graph.py b/pymc3/model_graph.py index 6b26d13312..02628c5f83 100644 --- a/pymc3/model_graph.py +++ b/pymc3/model_graph.py @@ -108,7 +108,7 @@ def _make_node(self, var_name, graph): distribution = 'Deterministic' attrs['shape'] = 'box' - graph.node(var_name, + graph.node(var_name.replace(':', '&'), '{var_name} ~ {distribution}'.format(var_name=var_name, distribution=distribution), **attrs) @@ -167,7 +167,7 @@ def make_graph(self): for key, values in self.make_compute_graph().items(): for value in values: - graph.edge(value, key) + graph.edge(value.replace(':', '&'), key.replace(':', '&')) return graph