Skip to content

Commit 1ff73e6

Browse files
Use etuples package and new kanren graph functions
"etuplization" of meta graphs also needed to be changed so that only meta variables are given S-expression/etuple forms, instead of all meta symbols.
1 parent fe370f5 commit 1ff73e6

31 files changed

+488
-1681
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ docstyle:
4646

4747
format:
4848
@printf "Checking code style with black...\n"
49-
black --check symbolic_pymc/
49+
black --check symbolic_pymc/ tests/
5050
@printf "\033[1;34mBlack passes!\033[0m\n\n"
5151

5252
style:

README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,11 @@ from functools import partial
5656
from unification import var
5757

5858
from kanren import run
59+
from kanren.graph import reduceo, walko
5960

6061
from symbolic_pymc.theano.printing import tt_pprint
6162
from symbolic_pymc.theano.pymc3 import model_graph
6263

63-
from symbolic_pymc.relations.graph import reduceo
64-
from symbolic_pymc.relations.theano import tt_graph_applyo
6564
from symbolic_pymc.relations.theano.conjugates import conjugate
6665

6766
theano.config.cxx = ''
@@ -97,7 +96,7 @@ def conjugate_graph(graph):
9796
"""Apply conjugate relations throughout a graph."""
9897

9998
def fixedp_conjugate_applyo(x, y):
100-
return reduceo(partial(tt_graph_applyo, conjugate), x, y)
99+
return reduceo(partial(walko, conjugate), x, y)
101100

102101
expr_graph, = run(1, var('q'),
103102
fixedp_conjugate_applyo(graph, var('q')))
@@ -147,13 +146,13 @@ from functools import partial
147146
from unification import var
148147

149148
from kanren import run
149+
from kanren.graph import reduceo
150150

151151
from symbolic_pymc.theano.meta import mt
152152
from symbolic_pymc.theano.pymc3 import model_graph, graph_model
153153
from symbolic_pymc.theano.utils import canonicalize
154154

155-
from symbolic_pymc.relations.graph import reduceo
156-
from symbolic_pymc.relations.theano import non_obs_graph_applyo
155+
from symbolic_pymc.relations.theano import non_obs_walko
157156
from symbolic_pymc.relations.theano.distributions import scale_loc_transform
158157

159158

@@ -189,12 +188,12 @@ def reparam_graph(graph):
189188

190189
graph_mt = mt(graph)
191190

192-
def scale_loc_fixedp_applyo(x, y):
193-
return reduceo(partial(non_obs_graph_applyo, scale_loc_transform), x, y)
191+
def scale_loc_fixedp_walko(x, y):
192+
return reduceo(partial(non_obs_walko, scale_loc_transform), x, y)
194193

195194
expr_graph = run(0, var('q'),
196195
# Apply our transforms to unobserved RVs only
197-
scale_loc_fixedp_applyo(graph_mt, var('q')))
196+
scale_loc_fixedp_walko(graph_mt, var('q')))
198197

199198
expr_graph = expr_graph[0]
200199
opt_graph_tt = expr_graph.reify()

symbolic_pymc/constraints.py

Lines changed: 0 additions & 177 deletions
This file was deleted.

0 commit comments

Comments
 (0)