Commit 5d2de77b authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

minimize(_nested)_blockmodel_dl(): Fix handling of clabel and pclabel

parent 78dcac84
Pipeline #135 failed with stage
......@@ -312,7 +312,6 @@ class BlockState(object):
vweight=self.wr if vweight else self.bg.new_vp("int", 1),
b=self.bg.vertex_index.copy("int") if b is None else b,
deg_corr=deg_corr,
pclabel=self.get_bpclabel(),
degs=degs,
max_BE=self.max_BE, **kwargs)
return state
......
......@@ -423,7 +423,6 @@ class LayeredBlockState(OverlapBlockState, BlockState):
vweight=bg.own_property(self.wr.copy()) if vweight else None,
b=bg.vertex_index.copy("int") if b is None else b,
deg_corr=deg_corr,
pclabel=self.get_bpclabel(),
overlap=overlap,
max_BE=self.max_BE,
layers=self.layers if layers is None else layers,
......
......@@ -286,6 +286,8 @@ def minimize_blockmodel_dl(g, B_min=None, B_max=None, b_min=None, b_max=None,
**bisection_args)
clabel = state_args.get("clabel", None)
if clabel is None:
clabel = state_args.get("pclabel", None)
min_state, max_state = get_states(g, B_min=B_min, B_max=B_max, b_min=b_min,
b_max=b_max, deg_corr=deg_corr,
......@@ -455,6 +457,8 @@ def minimize_nested_blockmodel_dl(g, B_min=None, B_max=None, b_min=None,
if bs is None:
clabel = state_args.get("clabel", None)
if clabel is None:
clabel = state_args.get("pclabel", None)
min_state, max_state = get_states(g, B_min=B_min, B_max=B_max,
b_min=b_min, b_max=b_max,
deg_corr=deg_corr, overlap=overlap,
......
......@@ -58,7 +58,7 @@ class NestedBlockState(object):
def __init__(self, g, bs, base_type=BlockState, **kwargs):
self.g = g
self.kwargs = copy.deepcopy(kwargs)
self.kwargs = kwargs.copy()
self.levels = [base_type(g, b=bs[0], **self.kwargs)]
for b in bs[1:]:
state = self.levels[-1]
......@@ -302,8 +302,7 @@ class NestedBlockState(object):
**mcmc_multilevel_args)
if l < len(self.levels) - 1:
if B_min is None:
min_state = state.copy(b=self.project_partition(l + 1, l),
clabel=clabel)
min_state = state.copy(b=clabel, clabel=clabel)
else:
min_state = mcmc_multilevel(max_state, B_min,
**mcmc_multilevel_args)
......@@ -311,8 +310,7 @@ class NestedBlockState(object):
assert min_state.B == self.levels[l+1].B, (min_state.B,
self.levels[l+1].N)
else:
min_state = state.copy(b=zeros(len(state.b.fa)),
clabel=clabel)
min_state = state.copy(b=clabel, clabel=clabel)
if B_min is not None and min_state.B > B_min:
min_state = mcmc_multilevel(min_state, B_min,
**mcmc_multilevel_args)
......
......@@ -278,7 +278,6 @@ class OverlapBlockState(BlockState):
vweight=wr if vweight else None,
b=bg.vertex_index.copy("int") if b is None else b,
deg_corr=deg_corr,
pclabel=self.get_bpclabel(),
max_BE=self.max_BE, **kwargs)
else:
## FIXME: Move this to C++
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment