Am 11.11.21 um 03:03 schrieb Eli Draizen:
Hi everyone,

I was wondering if it would be possible to provide some more examples of how to run a nested mixed membership SBM with edge weights. The new version seems to have removed the "overlap=True" option for state_args in the minimize_* functions.

Indeed, I will add more examples about this. Could you please open an issue in the website so I don't forget?

Is this the correct way to do it now?

    import graph_tool as gta
    import numpy as np
    g = .... # build graph
    e_score = .... #Set edge weights
    state_args = dict(
         deg_corr=deg_corr,
         base_type=gta.inference.overlap_blockmodel.OverlapBlockState,
         B=2*g.num_edges(), #B_max
         deg_corr=True,
         recs=[e_score],
         rec_types=["real-normal"])
    state = gta.inference.minimize_nested_blockmodel_dl(
         g,
         state_args=state_args,
         multilevel_mcmc_args=dict(verbose=True))
    # improve solution with merge-split
    state = state.copy(bs=state.get_bs() + [np.zeros(1)] * 4, sampling=True)

    for i in range(100):
         if i%10==0: print(".", end="")
         ret = state.multiflip_mcmc_sweep(niter=10, beta=np.inf,
    verbose=True)
This is correct. But note that the "sampling=True" option is no longer needed.

I am currently running this for a fully connected bipartite graph with 3454 nodes and 55008 edges. I understand it would take longer than the non-overlapping version, but do you have any suggestions on how to speed it up? The non-overlapping version takes about 15 minutes, while the overlapping version is still running after 1 day.
The new version will contain a much faster code for the overlapping case!

But in the mean-time, what you can do is to fit the non-overlapping model first, and use that as a starting point to the MCMC with overlap. You do that simply by doing:

       state = state.copy(state_args=dict(overlap=True))

Best,
Tiago




--
Tiago de Paula Peixoto <ti...@skewed.de>
_______________________________________________
graph-tool mailing list -- graph-tool@skewed.de
To unsubscribe send an email to graph-tool-le...@skewed.de

Reply via email to