Am 26.09.18 um 14:43 schrieb Adrien Dulac:
Dear all,
I am a bit confused about the use of the weighted network models for a weight prediction task;
Suppose we have a weighted network where edges are integers. We fit a SBM with a Poisson kernel as follows:
|data = gt.load_graph(...) # The adjacency matrix has integer entries, and weights greater than zero are stored in data.ep.weights. state = gt.inference.minimize_blockmodel(data, B_min=10, B_max=10, state_args= {'recs':[data.ep.weights], 'rec_types' : ["discrete-poisson"]}) |
My question, is how can we obtain, from |state|, a point estimate of the Poisson parameters in order to compute the distribution of the weights between pairs of nodes.
It's not this simple, since the model is microcanonical and contains hyperpriors, etc. The easiest thing you can do is compute the conditional posterior distribution of an edge and its weight. You get this by adding the missing edge with the desired weight to the graph, and computing the difference in the state.entropy(), which gives the (un-normalized) negative log probability (remember you have to copy the state with state.copy(g=g_new), after modifying the graph). By normalizing this over all weight values, you have the conditional posterior distribution of the weight. (This could be done faster by using BlockState.get_edges_prob(), but that does not support edge covariates yet.) Best, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>