Hi Prof. Peixoto,
My graph-tool version: 2.72
OS: ubuntu 22
gt.PPBlockState
throws a semantic error: NameError: name 'log' is not defined
.
Other SBM variants work fine.
MWE:
import graph_tool.all as gt
import numpy as np
class ARGS():
pass
args = ARGS()
args.SEED = 100
def mcmc_eq(args, g, state):
bs = [] # partitions
Bs = np.zeros(g.num_vertices() + 1) # number of blocks
Bes = [] # number of effective blocks
dls = [] # description length history
def collect_partitions(s):
bs.append(s.b.a.copy())
B = s.get_nonempty_B()
Bs[B] += 1
Bes.append(s.get_Be())
dls.append(s.entropy())
gt.mcmc_equilibrate(
state,
wait=args.wait,
force_niter=args.force_niter,
mcmc_args=dict(niter=args.niter),
callback=collect_partitions,
)
return state, bs, Bs, Bes, dls
g = gt.collection.ns["new_guinea_tribes"]
state = gt.PPBlockState(
g,
)
# state = gt.minimize_blockmodel_dl(g, state=gt.PPBlockState)
args.wait = 12
args.force_niter = 100
args.niter = 10
state, bs, Bs, Bes, dls = mcmc_eq(args, g, state)
state
Many thanks,
Govinda