Commit bfd485ee authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

inference: Remove unnecessary auxiliary functions

parent 4a5bc229
Pipeline #217 failed with stage
in 265 minutes and 58 seconds
......@@ -67,7 +67,7 @@ def get_ent(state, mcmc_multilevel_args, extra_entropy_args):
mcmc_equilibrate_args = mcmc_multilevel_args.get("mcmc_equilibrate_args", {})
mcmc_args = mcmc_equilibrate_args.get("mcmc_args", {})
entropy_args = mcmc_args.get("entropy_args", {})
S = state.entropy(**overlay(entropy_args, **extra_entropy_args))
S = state.entropy(**dict(entropy_args, **extra_entropy_args))
return S
def get_state_dl(B, b_cache, mcmc_multilevel_args={}, extra_entropy_args={},
......@@ -78,11 +78,11 @@ def get_state_dl(B, b_cache, mcmc_multilevel_args={}, extra_entropy_args={},
B_prev = Bs[bisect.bisect(Bs, B)]
state = b_cache[B_prev][1]
state = mcmc_multilevel(state,
**overlay(mcmc_multilevel_args,
B=B,
verbose=verbose_push(verbose,
("B: %d <- %d " %
(B, B_prev)))))
**dict(mcmc_multilevel_args,
B=B,
verbose=verbose_push(verbose,
("B: %d <- %d " %
(B, B_prev)))))
dl = get_ent(state, mcmc_multilevel_args, extra_entropy_args)
b_cache[B] = (dl, state)
return dl
......@@ -146,8 +146,8 @@ def bisection_minimize(init_states, random_bisection=False,
mid_B = get_mid(min_B, max_B, random=random_bisection)
kwargs = dict(b_cache=b_cache,
mcmc_multilevel_args=overlay(mcmc_multilevel_args,
b_cache=b_cache),
mcmc_multilevel_args=dict(mcmc_multilevel_args,
b_cache=b_cache),
extra_entropy_args=extra_entropy_args,
verbose=verbose_push(verbose, (" " * 4)))
......
......@@ -132,7 +132,7 @@ def get_entropy_args(kargs):
del kargs["partition_dl"]
del kargs["degree_dl"]
del kargs["edges_dl"]
extract_arg(kargs, "callback", None)
kargs.pop("callback", None)
if len(kargs) > 0:
raise ValueError("unrecognized entropy arguments: " +
str(list(kargs.keys())))
......@@ -228,7 +228,7 @@ class BlockState(object):
self.deg_corr = deg_corr
self.overlap = False
self.degs = extract_arg(kwargs, "degs", libinference.simple_degs_t())
self.degs = kwargs.pop("degs", libinference.simple_degs_t())
if self.degs is None:
self.degs = libinference.simple_degs_t()
......@@ -266,12 +266,12 @@ class BlockState(object):
self.rec = self.g.new_ep("double")
else:
self.rec = rec.copy("double")
self.drec = extract_arg(kwargs, "drec", None)
self.drec = kwargs.pop("drec", None)
if self.drec is None:
self.drec = self.rec.copy()
self.drec.fa **= 2
else:
self.drec = self.drec.copy()
self.drec = self.drec.copy("double")
# Construct block-graph
self.bg = get_block_graph(g, B, self.b, self.vweight, self.eweight,
......@@ -319,14 +319,14 @@ class BlockState(object):
self.use_hash = self.B > self.max_BE
self.ignore_degrees = extract_arg(kwargs, "ignore_degrees", None)
self.ignore_degrees = kwargs.pop("ignore_degrees", None)
if self.ignore_degrees is None:
self.ignore_degrees = g.new_vp("bool", False)
else:
self.ignore_degrees = self.ignore_degrees.copy("bool")
self.merge_map = extract_arg(kwargs, "merge_map",
self.g.vertex_index.copy("int"))
self.merge_map = kwargs.pop("merge_map",
self.g.vertex_index.copy("int"))
self.candidate_blocks = Vector_size_t()
self.candidate_pos = self.bg.new_vp("int")
......@@ -430,41 +430,36 @@ class BlockState(object):
pclabel=self.pclabel if pclabel is None else pclabel,
deg_corr=self.deg_corr if deg_corr is None else deg_corr,
max_BE=self.max_BE if max_BE is None else max_BE,
ignore_degrees=kwargs.pop("ignore_degrees",
self.ignore_degrees),
degs=self.degs.copy(),
merge_map=kwargs.get("merge_map",
merge_map=kwargs.pop("merge_map",
self.merge_map.copy()),
rec=kwargs.get("rec", self.rec),
drec=kwargs.get("drec", self.drec),
rec_type=kwargs.get("rec_type", self.rec_type),
rec_params=kwargs.get("rec_params",
rec=kwargs.pop("rec", self.rec),
drec=kwargs.pop("drec", self.drec),
rec_type=kwargs.pop("rec_type", self.rec_type),
rec_params=kwargs.pop("rec_params",
self.rec_params),
allow_empty=kwargs.get("allow_empty",
ignore_degrees=kwargs.pop("ignore_degrees",
self.ignore_degrees),
allow_empty=kwargs.pop("allow_empty",
self.allow_empty),
**dmask(kwargs,
["ignore_degrees", "merge_map", "rec",
"rec_type", "rec_params", "drec",
"allow_empty"]))
**kwargs)
else:
state = OverlapBlockState(self.g if g is None else g,
b=self.b.copy() if b is None else b,
B=(self.B if b is None else None) if B is None else B,
rec=kwargs.get("rec", self.rec),
drec=kwargs.get("drec", self.drec),
rec_type=kwargs.get("rec_type",
rec=kwargs.pop("rec", self.rec),
drec=kwargs.pop("drec", self.drec),
rec_type=kwargs.pop("rec_type",
self.rec_type),
rec_params=kwargs.get("rec_params",
rec_params=kwargs.pop("rec_params",
self.rec_params),
clabel=self.clabel if clabel is None else clabel,
pclabel=self.pclabel if pclabel is None else pclabel,
deg_corr=self.deg_corr if deg_corr is None else deg_corr,
allow_empty=kwargs.get("allow_empty",
allow_empty=kwargs.pop("allow_empty",
self.allow_empty),
max_BE=self.max_BE if max_BE is None else max_BE,
**dmask(kwargs, ["rec", "rec_type",
"rec_params", "drec",
"allow_empty"]))
**kwargs)
return state
......@@ -540,17 +535,19 @@ class BlockState(object):
vweight=vweight,
b=bg.vertex_index.copy("int") if b is None else b,
deg_corr=deg_corr,
allow_empty=kwargs.get("allow_empty",
allow_empty=kwargs.pop("allow_empty",
self.allow_empty),
degs=degs,
rec_type=kwargs.get("rec_type", self.rec_type if vweight else None),
rec=kwargs.get("rec", bg.ep.rec if vweight else None),
drec=kwargs.get("drec", bg.ep.drec if vweight else None),
rec_params=kwargs.get("rec_params", self.rec_params),
rec_type=kwargs.pop("rec_type", self.rec_type if vweight else None),
rec=kwargs.pop("rec", bg.ep.rec if vweight else None),
drec=kwargs.pop("drec", bg.ep.drec if vweight else None),
rec_params=kwargs.pop("rec_params", self.rec_params),
ignore_degrees=kwargs.pop("ignore_degrees",
self.get_bclabel(clabel=self.ignore_degrees)),
clabel=kwargs.pop("clabel", self.get_bclabel()),
pclabel=kwargs.pop("pclabel", self.get_bpclabel()),
max_BE=self.max_BE,
**dmask(kwargs, ["allow_empty", "rec_type",
"rec_params", "rec", "drec",
"deg_corr"]))
**kwargs)
return state
def get_E(self):
......@@ -833,17 +830,18 @@ class BlockState(object):
kind = libinference.deg_dl_kind.dist
S += self._state.get_deg_dl(kind)
callback = extract_arg(kwargs, "callback", None)
callback = kwargs.pop("callback", None)
if callback is not None:
S += callback(self)
if extract_arg(kwargs, "test", True) and _bm_test():
if kwargs.pop("test", True) and _bm_test():
assert not isnan(S) and not isinf(S), \
"invalid entropy %g (%s) " % (S, str(args))
args["test"] = False
state_copy = self.copy()
Salt = state_copy.entropy(**args)
assert abs(S - Salt) < 1e-6, \
"entropy discrepancy after copying (%g %g)" % (S, Salt)
......@@ -902,8 +900,8 @@ class BlockState(object):
remaining parameters are the same as in
:meth:`graph_tool.BlockState.entropy`."""
return self._state.virtual_move(int(v), self.b[v], s,
get_entropy_args(overlay(self._entropy_args,
**kwargs)))
get_entropy_args(dict(self._entropy_args,
**kwargs)))
def move_vertex(self, v, s):
r"""Move vertex ``v`` to block ``s``.
......@@ -1043,8 +1041,8 @@ class BlockState(object):
self.add_vertex(pos.keys(), pos.values())
Sf = self.entropy(**overlay(dict(partition_dl=False),
**entropy_args))
Sf = self.entropy(**dict(dict(partition_dl=False),
**entropy_args))
self.remove_vertex(pos.keys())
......@@ -1151,7 +1149,7 @@ class BlockState(object):
"""
mcmc_state = DictState(locals())
entropy_args = overlay(self._entropy_args, **entropy_args)
entropy_args = dict(self._entropy_args, **entropy_args)
if (_bm_test() and entropy_args["multigraph"] and
not entropy_args["dense"] and
hasattr(self, "degs") and
......@@ -1170,7 +1168,7 @@ class BlockState(object):
mcmc_state.E = self.get_E()
mcmc_state.state = self._state
disable_callback_test = extract_arg(kwargs, "disable_callback_test", False)
disable_callback_test = kwargs.pop("disable_callback_test", False)
if _bm_test():
assert self._check_clabel(), "invalid clabel before sweep"
if disable_callback_test:
......@@ -1252,7 +1250,7 @@ class BlockState(object):
"""
gibbs_state = DictState(locals())
entropy_args = overlay(self._entropy_args, **entropy_args)
entropy_args = dict(self._entropy_args, **entropy_args)
gibbs_state.entropy_args = get_entropy_args(entropy_args)
gibbs_state.vlist = Vector_size_t()
if vertices is None:
......@@ -1266,7 +1264,7 @@ class BlockState(object):
gibbs_state.E = self.get_E()
gibbs_state.state = self._state
disable_callback_test = extract_arg(kwargs, "disable_callback_test", False)
disable_callback_test = kwargs.pop("disable_callback_test", False)
if _bm_test():
assert self._check_clabel(), "invalid clabel before sweep"
if disable_callback_test:
......@@ -1355,7 +1353,7 @@ class BlockState(object):
niter *= self.g.num_vertices()
args = dmask(locals(), ["self"])
multi_state = DictState(args)
entropy_args = overlay(self._entropy_args, **entropy_args)
entropy_args = dict(self._entropy_args, **entropy_args)
multi_state.entropy_args = get_entropy_args(entropy_args)
multi_state.update(entropy_args)
multi_state.vlist = Vector_size_t()
......@@ -1385,7 +1383,7 @@ class BlockState(object):
m_state._f = f
m_state._time = time
disable_callback_test = extract_arg(kwargs, "disable_callback_test", False)
disable_callback_test = kwargs.pop("disable_callback_test", False)
if _bm_test():
assert self._check_clabel(), "invalid clabel after sweep"
......@@ -1469,7 +1467,7 @@ class BlockState(object):
"""
exhaustive_state = DictState(dict(max_iter=max_iter if max_iter is not None else 0))
entropy_args = overlay(self._entropy_args, **entropy_args)
entropy_args = dict(self._entropy_args, **entropy_args)
exhaustive_state.entropy_args = get_entropy_args(entropy_args)
exhaustive_state.vlist = Vector_size_t()
if vertices is None:
......@@ -1560,10 +1558,10 @@ class BlockState(object):
merge_state = DictState(locals())
merge_state.E = self.get_E()
merge_state.state = self._state
entropy_args = overlay(self._entropy_args, **entropy_args)
entropy_args = dict(self._entropy_args, **entropy_args)
merge_state.entropy_args = get_entropy_args(entropy_args)
disable_callback_test = extract_arg(kwargs, "disable_callback_test", False)
disable_callback_test = kwargs.pop("disable_callback_test", False)
if _bm_test():
self._check_clabel()
if disable_callback_test:
......
......@@ -109,7 +109,7 @@ class LayeredBlockState(OverlapBlockState, BlockState):
self.g = g
if extract_arg(kwargs, "ec_done", False):
if kwargs.pop("ec_done", False):
self.ec = ec
else:
self.ec = ec = perfect_prop_hash([ec], "int32_t")[0]
......@@ -130,7 +130,7 @@ class LayeredBlockState(OverlapBlockState, BlockState):
if not overlap:
kwargs = dmask(kwargs, ["base_g", "node_index", "eindex",
"half_edges"])
ldegs = extract_arg(kwargs, "degs", libinference.simple_degs_t())
ldegs = kwargs.pop("degs", libinference.simple_degs_t())
if not isinstance(ldegs, libinference.simple_degs_t):
tdegs = libinference.get_mapped_block_degs(self.g._Graph__graph,
ldegs, 0,
......@@ -201,7 +201,7 @@ class LayeredBlockState(OverlapBlockState, BlockState):
self.gs = []
self.block_map = libinference.bmap_t()
lweights = extract_arg(kwargs, "lweights", g.new_vp("vector<int>"))
lweights = kwargs.pop("lweights", g.new_vp("vector<int>"))
for l in range(0, self.C):
u = Graph(directed=g.is_directed())
......@@ -260,7 +260,7 @@ class LayeredBlockState(OverlapBlockState, BlockState):
self.block_list = Vector_size_t()
self.block_list.extend(arange(agg_state.B, dtype="int"))
self.__layer_entropy = extract_arg(kwargs, "layer_entropy", None)
self.__layer_entropy = kwargs.pop("layer_entropy", None)
if not self.overlap:
self._state = \
......@@ -278,9 +278,9 @@ class LayeredBlockState(OverlapBlockState, BlockState):
if _bm_test():
assert self.mrs.fa.sum() == self.eweight.fa.sum(), "inconsistent mrs!"
extract_arg(kwargs, "rec")
extract_arg(kwargs, "drec")
extract_arg(kwargs, "rec_params")
kwargs.pop("rec", None)
kwargs.pop("drec", None)
kwargs.pop("rec_params", None)
if len(kwargs) > 0:
raise ValueError("unrecognized keyword arguments: " +
......@@ -511,23 +511,25 @@ class LayeredBlockState(OverlapBlockState, BlockState):
state = LayeredBlockState(bg, ec, eweight=mrs,
vweight=bg.own_property(self.wr.copy()) if vweight else None,
rec_type=kwargs.get("rec_type", self.rec_type if vweight else None),
rec=kwargs.get("rec", rec if vweight else None),
drec=kwargs.get("drec", drec if vweight else None),
rec_params=kwargs.get("rec_params", self.rec_params),
rec_type=kwargs.pop("rec_type", self.rec_type if vweight else None),
rec=kwargs.pop("rec", rec if vweight else None),
drec=kwargs.pop("drec", drec if vweight else None),
rec_params=kwargs.pop("rec_params", self.rec_params),
b=bg.vertex_index.copy("int") if b is None else b,
deg_corr=deg_corr,
overlap=overlap,
allow_empty=kwargs.get("allow_empty",
allow_empty=kwargs.pop("allow_empty",
self.allow_empty),
max_BE=self.max_BE,
layers=self.layers if layers is None else layers,
ec_done=True,
degs=degs, lweights=lweights,
layer_entropy=layer_entropy,
**dmask(kwargs,
["allow_empty", "rec_type",
"rec", "drec", "rec_params"]))
clabel=kwargs.pop("clabel",
self.agg_state.get_bclabel()),
pclabel=kwargs.pop("pclabel",
self.agg_state.get_bpclabel()),
**kwargs)
return state
......@@ -613,7 +615,7 @@ class LayeredBlockState(OverlapBlockState, BlockState):
degree_dl_kind=degree_dl_kind, edges_dl=False,
dense=dense, multigraph=multigraph,
deg_entropy=deg_entropy, exact=exact,
**overlay(kwargs, test=False))
**dict(kwargs, test=False))
if dl and edges_dl:
if self.allow_empty:
......@@ -726,8 +728,7 @@ class LayeredBlockState(OverlapBlockState, BlockState):
self.add_vertex(pos.keys(), pos.values())
Sf = self.entropy(**overlay(dict(partition_dl=False),
**entropy_args))
Sf = self.entropy(**dict(dict(partition_dl=False), **entropy_args))
self.remove_vertex(pos.keys())
......
......@@ -250,13 +250,13 @@ def mcmc_anneal(state, beta_range=(1., 10.), niter=100, history=False,
mcmc_args = mcmc_equilibrate_args.get("mcmc_args", {})
while beta < beta_range[1] * speed:
ret = mcmc_equilibrate(state,
**overlay(mcmc_equilibrate_args,
mcmc_args=overlay(mcmc_args,
beta=beta),
history=history,
verbose=verbose_push(verbose,
("β: %#8.6g " %
beta))))
**dict(mcmc_equilibrate_args,
mcmc_args=dict(mcmc_args,
beta=beta),
history=history,
verbose=verbose_push(verbose,
("β: %#8.6g " %
beta))))
if history:
ret = list(zip(*ret))
hist[0].extend([beta] * len(ret[0]))
......@@ -358,16 +358,16 @@ def mcmc_multilevel(state, B, r=2, b_cache=None, anneal=False,
state = state.shrink(B=B_next, **shrink_args)
if anneal:
mcmc_anneal(state,
**overlay(anneal_args,
mcmc_equilibrate_args=mcmc_equilibrate_args,
verbose=verbose_push(verbose,
"B=%d " % state.B)))
**dict(anneal_args,
mcmc_equilibrate_args=mcmc_equilibrate_args,
verbose=verbose_push(verbose,
"B=%d " % state.B)))
else:
mcmc_equilibrate(state,
**overlay(mcmc_equilibrate_args,
verbose=verbose_push(verbose,
("B=%d " %
state.B))))
**dict(mcmc_equilibrate_args,
verbose=verbose_push(verbose,
("B=%d " %
state.B))))
if b_cache is not None:
mcmc_args = mcmc_equilibrate_args.get("mcmc_args", {})
entropy_args = mcmc_args.get("entropy_args", {})
......
......@@ -34,29 +34,29 @@ from . nested_blockmodel import *
def default_args(mcmc_args={}, anneal_args={}, mcmc_equilibrate_args={},
shrink_args={}, mcmc_multilevel_args={}, overlap=False):
mcmc_args = overlay(dict(beta=numpy.inf, c=0, niter=5, allow_vacate=False,
entropy_args=dict(dl=True)), **mcmc_args)
mcmc_args = dict(dict(beta=numpy.inf, c=0, niter=5, allow_vacate=False,
entropy_args=dict(dl=True)), **mcmc_args)
if overlap:
mcmc_args = overlay(mcmc_args, bundled=True)
mcmc_equilibrate_args = overlay(dict(wait=1, nbreaks=1, epsilon=1e-4,
mcmc_args=mcmc_args),
**dmask(mcmc_equilibrate_args,
["mcmc_args"]))
shrink_entropy_args = overlay(overlay(mcmc_args["entropy_args"],
dl=not overlap),
**shrink_args.get("entropy_args", {}))
mcmc_args = dict(mcmc_args, bundled=True)
mcmc_equilibrate_args = dict(dict(wait=1, nbreaks=1, epsilon=1e-4,
mcmc_args=mcmc_args),
**dmask(mcmc_equilibrate_args,
["mcmc_args"]))
shrink_entropy_args = dict(dict(mcmc_args["entropy_args"],
dl=not overlap),
**shrink_args.get("entropy_args", {}))
if not shrink_entropy_args.get("dense", False):
shrink_entropy_args["multigraph"] = False
shrink_args = overlay(dict(entropy_args=shrink_entropy_args, niter=10),
**dmask(shrink_args, ["entropy_args"]))
shrink_args = dict(dict(entropy_args=shrink_entropy_args, niter=10),
**dmask(shrink_args, ["entropy_args"]))
mcmc_multilevel_args = \
overlay(dict(r=1.5, anneal=False,
shrink_args=shrink_args,
mcmc_equilibrate_args=mcmc_equilibrate_args,
anneal_args=anneal_args),
**dmask(mcmc_multilevel_args,
["shrink_args", "mcmc_equilibrate_args",
"anneal_args"]))
dict(dict(r=1.5, anneal=False,
shrink_args=shrink_args,
mcmc_equilibrate_args=mcmc_equilibrate_args,
anneal_args=anneal_args),
**dmask(mcmc_multilevel_args,
["shrink_args", "mcmc_equilibrate_args",
"anneal_args"]))
return mcmc_multilevel_args
......@@ -83,7 +83,7 @@ def get_states(g, B_min=None, B_max=None, b_min=None, b_max=None, deg_corr=True,
if layers:
State = LayeredBlockState
state_args = overlay(state_args, overlap=overlap)
state_args = dict(state_args, overlap=overlap)
elif overlap:
State = OverlapBlockState
else:
......@@ -277,13 +277,13 @@ def minimize_blockmodel_dl(g, B_min=None, B_max=None, b_min=None, b_max=None,
anneal_args=anneal_args,
mcmc_equilibrate_args=mcmc_equilibrate_args,
shrink_args=shrink_args,
mcmc_multilevel_args=overlay(mcmc_multilevel_args,
b_cache=b_cache),
mcmc_multilevel_args=dict(mcmc_multilevel_args,
b_cache=b_cache),
overlap=overlap)
bisection_args = overlay(dict(mcmc_multilevel_args=mcmc_multilevel_args,
random_bisection=False),
**bisection_args)
bisection_args = dict(dict(mcmc_multilevel_args=mcmc_multilevel_args,
random_bisection=False),
**bisection_args)
clabel = state_args.get("clabel", None)
if clabel is None:
......@@ -497,16 +497,16 @@ def minimize_nested_blockmodel_dl(g, B_min=None, B_max=None, b_min=None,
bstate = bstate.get_block_state()
if layers:
state_args = overlay(state_args, overlap=overlap)
state_args = dict(state_args, overlap=overlap)
state = NestedBlockState(g, bs=bs,
base_type=type(min_state),
deg_corr=deg_corr,
**dmask(state_args, ["deg_corr"]))
bisection_args = overlay(dict(mcmc_multilevel_args=mcmc_multilevel_args,
random_bisection=False),
**bisection_args)
bisection_args = dict(dict(mcmc_multilevel_args=mcmc_multilevel_args,
random_bisection=False),
**bisection_args)
hierarchy_minimize(state, B_max=B_max, B_min=B_min, b_max=b_max,
b_min=b_min, bisection_args=bisection_args,
......
......@@ -257,8 +257,8 @@ class NestedBlockState(object):
else:
eargs = kwargs
S = bstate.entropy(**overlay(eargs, dl=True,
edges_dl=(l == (len(self.levels) - 1))))
S = bstate.entropy(**dict(eargs, dl=True,
edges_dl=(l == (len(self.levels) - 1))))
return S
def entropy(self, **kwargs):
......@@ -333,8 +333,8 @@ class NestedBlockState(object):
else:
eargs = entropy_args
eargs = overlay(eargs, dl=True,
edges_dl=(l == (len(self.levels) - 1)))
eargs = dict(eargs, dl=True,
edges_dl=(l == (len(self.levels) - 1)))
if self.sampling:
lstate._couple_state(None, None)
......@@ -408,31 +408,31 @@ class NestedBlockState(object):
mcmc_equilibrate_args = mcmc_multilevel_args.get("mcmc_equilibrate_args", {})
mcmc_args = mcmc_equilibrate_args.get("mcmc_args", {})
entropy_args = mcmc_args.get("entropy_args", {})
entropy_args = overlay(entropy_args, dl=True,
edges_dl=l==len(self.levels) - 1)
entropy_args = dict(entropy_args, dl=True,
edges_dl=l==len(self.levels) - 1)
extra_entropy_args = bisection_args.get("extra_entropy_args", {})
if l > 0 and self.hentropy_args.get("dense"):
entropy_args = overlay(entropy_args,
dense=self.levels[l].get_N() < sparse_thres)
entropy_args = dict(entropy_args,
dense=self.levels[l].get_N() < sparse_thres)
if self.levels[l].get_N() >= sparse_thres:
extra_entropy_args = overlay(extra_entropy_args, dense=True)
extra_entropy_args = dict(extra_entropy_args, dense=True)
if l < len(self.levels) - 1:
entropy_args = overlay(entropy_args,
callback=lambda s: get_edges_dl(s,
self.hstate_args,
self.hentropy_args))
mcmc_args = overlay(mcmc_args, entropy_args=entropy_args,
disable_callback_test=isinstance(self.levels[0],
LayeredBlockState))
entropy_args = dict(entropy_args,
callback=lambda s: get_edges_dl(s,
self.hstate_args,
self.hentropy_args))
mcmc_args = dict(mcmc_args, entropy_args=entropy_args,