示例#1
0
    cbar=False,
    font_scale=1.4,
    vmin=0,
    vmax=1,
    inner_hier_labels=right_labels,
    hier_label_fontsize=16,
    cmap=cmap,
    center=None,
)
side_label_kws = dict(labelpad=45, fontsize=24)

fig, ax = plt.subplots(3, 2, figsize=(10, 17))

# SBM
heatmap(sbm.p_mat_, ax=ax[0, 0], title="Probability matrix", **heatmap_kws)
heatmap(np.squeeze(sbm.sample()),
        ax=ax[0, 1],
        title="Random sample",
        **heatmap_kws)
ax[0, 0].set_ylabel("SBM", **side_label_kws)

# DCSBM
heatmap(dcsbm.p_mat_, ax=ax[1, 0], **heatmap_kws)
heatmap(np.squeeze(dcsbm.sample()), ax=ax[1, 1], **heatmap_kws)
ax[1, 0].set_ylabel("DCSBM", **side_label_kws)

# RDPG
heatmap(rdpg.p_mat_, ax=ax[2, 0], **heatmap_kws)
heatmap(np.squeeze(rdpg.sample()), ax=ax[2, 1], **heatmap_kws)
ax[2, 0].set_ylabel("RDPG", **side_label_kws)
示例#2
0
sbme = SBMEstimator(directed=True,loops=False)
sbme.fit(adj, y=labels)
print("SBM \"B\" matrix:")
print(sbme.block_p_)
heatmap(sbme.p_mat_,
        inner_hier_labels=labels,
        vmin=0,
        vmax=1,
        font_scale=1.5,
        title="SBM probability matrix",
        sort_nodes=True)

plt.savefig("SBMProbabilityMatrix", bbox_inches='tight')

heatmap(sbme.sample()[0],
        inner_hier_labels=labels,
        font_scale=1.5,
        title="SBM sample",
        sort_nodes=True)

plt.savefig("SBMSample", bbox_inches='tight')

dcsbme = DCSBMEstimator(directed=True,loops=False)
dcsbme.fit(adj, y=labels)
print("DCSBM \"B\" matrix:")
print(dcsbme.block_p_)
heatmap(dcsbme.p_mat_,
        inner_hier_labels=labels,
        font_scale=1.5,
        title="DCSBM probability matrix",