On 26.04.2018 12:52, Zahra Sheikhbahaee wrote:
I am trying to include the edge weights by taking to account an edge covariate matrix for the nested block model inference. Well, Each time I run the code on my data set I get slightly different results both in terms of number of blocks and the nodes in each block.
This is because the inference is made using MCMC, which is a stochastic algorithm. You have to run it multiple times, and select the result with largest posterior probability (if you only want a point estimate).
This is my code: state = minimize_nested_blockmodel_dl(g, state_args=dict(recs=[g.edge_properties["weight"]], rec_types=["discrete-geometric"])) state.draw(edge_color=prop_to_size(g.edge_properties["weight"], power=1, log=True), ecmap=(matplotlib.cm.gist_heat, .6), eorder=g.edge_properties["weight"], edge_pen_width=prop_to_size(g.edge_properties["weight"], 1, 4, power=1, log=True), edge_gradient=, vertex_text=g.vertex_properties["attribute"], vertex_text_position="centered", vertex_text_rotation=g.vertex_properties['text_rotation'], vertex_font_size=10, vertex_font_family='mono', vertex_anchor=0, output_size=[1024*2,1024*2], output="DiscreteGeometric_%s.pdf"%(eventName))
Although it not important for the questions you have raised, it is not very useful to post incomplete code. Normally, for troubleshooting purposes, it is necessary for you to provide a _minimal_ and _self-contained_ program that anyone could execute and verify the problem you are reporting.
I appreciate if you explain what your approach would be and how I can run graph-tool using the covariance matrix of edges in order to get statistically reliable results?
This is covered in detail in the HOWTO:
and also in many papers, e.g.
However, I'm note sure what you mean by "covariance matrix of edges". The approach in question deals with graphs with edge covariates (a.k.a. weights). A covariance matrix usually refers to something else.
Is there also any way to get the full posterior of each node belonging to each block?
This is also explained in detail in the HOWTO: