Beispiel #1
0
# 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)

plt.tight_layout()

# Add colorbar
sm = plt.cm.ScalarMappable(cmap=cmap, norm=norm)
sm.set_array(rdpg.p_mat_)
cbar = fig.colorbar(sm,
                    ax=ax,
                    orientation="horizontal",
                    pad=0.01,
                    shrink=0.8,
                    fraction=0.1)
cbar.ax.tick_params(labelsize=16)
Beispiel #2
0
plt.savefig("DCSBMProbabilityMatrix", bbox_inches='tight')

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

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

rdpge = RDPGEstimator(loops=False)
rdpge.fit(adj, y=labels)
heatmap(rdpge.p_mat_,
        inner_hier_labels=labels,
        vmin=0,
        vmax=1,
        font_scale=1.5,
        title="RDPG probability matrix",
        sort_nodes=True
       )

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

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

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