Hi all,
I’ve recently updated graph-tool from 2.55 to 2.57 and I noticed different results on the same data. In general I obtain “less” blocks at every level of a NSBM hierarchy.
More in detail, I have a graph and minimize 100 NestedBlockStates, then I extract the consensus using PartitionModeState (get_max_nested).
I define the states like this
recs = []
rec_types = []
deg_corr = True
n_init=100
states = [gt.NestedBlockState(g=g,
state_args=dict(deg_corr=deg_corr,
recs=recs,
rec_types=rec_types)) for n in range(n_init)]
the minimization is performed like this
def fast_min(state, beta=np.inf, n_sweep=10, fast_tol=1e-6, max_iter=np.inf, seed=None):
if seed:
gt.seed_rng(seed)
dS = 1e9
n = 0
while (np.abs(dS) > fast_tol) and (n < max_iter):
dS, _, _ = state.multiflip_mcmc_sweep(beta=beta, niter=n_sweep, c=0.5)
n += 1
return state
the PartitionModeState is calculated as
pmode = gt.PartitionModeState([x.get_bs() for x in states], converge=True, nested=True)
Now, if I do everything on v2.57 the number of blocks I have in hierarchy is (only first 5)
print([len(set(pmode.get_max_nested()[x])) for x in range(5)])
[3, 40, 2, 4, 2]
If I do everything on v2.55 I have
print([len(set(pmode.get_max_nested()[x])) for x in range(5)])
[107, 24, 7, 4, 2]
If I perform minimization on 2.55 and pmode on 2.57 I have
print([len(set(pmode.get_max_nested()[x])) for x in range(5)])
[107, 25, 7, 4, 2]
whereas minization on 2.57 and pmode on 2.55 gives
print([len(set(pmode.get_max_nested()[x])) for x in range(5)])
[3, 40, 3, 4, 2]
Besides the fact I don’t understand how I can get less blocks at level 0 than level 1, the pmode step has no particular issues, but the minimization has.