Ejemplo n.º 1
0
def clustergram(
    adj, latent, prob_df, block_sum_df, true_labels, pred_labels, figsize=(20, 20)
):
    fig, ax = plt.subplots(2, 2, figsize=figsize)
    ax = ax.ravel()
    sns.set_context("talk", font_scale=2)
    color_dict = get_colors(true_labels, pred_labels)
    sankey(
        ax[0], true_labels, pred_labels, aspect=20, fontsize=16, colorDict=color_dict
    )
    ax[0].axis("off")
    ax[0].set_title("Known class sorting", fontsize=30, pad=45)

    ax[1] = heatmap(
        adj,
        transform="simple-all",
        inner_hier_labels=pred_labels,
        cbar=False,
        sort_nodes=True,
        ax=ax[1],
        cmap="PRGn_r",
        hier_label_fontsize=16,
    )
    ax[1].set_title("Sorted heatmap", fontsize=30, pad=70)

    probplot(100 * prob_df, ax=ax[2], title="Connection percentage")

    probplot(block_sum_df, ax=ax[3], title="Average synapses")
Ejemplo n.º 2
0
#     skeleton_labels,
#     class_labels,
#     class_colors,
#     multiout=True,
# )

title = (
    f"Divisive hierarchical clustering," +
    f" {cluster_type}, {embed_type} ({latent_dim} + {latent_dim}), {ptr_type},"
    + f" {brain_type}, {graph_type}")

fig, ax = plt.subplots(1, 1, figsize=(20, 30))
sankey(
    ax,
    class_labels[~is_sensory],
    true_pred_labels,
    aspect=20,
    fontsize=16,
    colorDict=all_color_dict,
)
ax.axis("off")
ax.set_title(title, fontsize=30)
stashfig("sankey" + name_base)

fig, ax = plt.subplots(1, 1, figsize=(20, 30))
sankey(
    ax,
    true_pred_labels,
    class_labels[~is_sensory],
    aspect=20,
    fontsize=16,
    colorDict=all_color_dict,
Ejemplo n.º 3
0
n_classes = len(np.unique(class_labels))
class_color_dict = get_color_dict(class_labels, pal=cc.glasbey_cool)
pred_color_dict = get_color_dict(pred_labels, pal=cc.glasbey_warm)
all_color_dict = {**class_color_dict, **pred_color_dict}

title = (
    f"Divisive hierarchical clustering," +
    f" {cluster_type}, {embed_type} ({latent_dim} + {latent_dim}), {ptr_type},"
    + f" {brain_type}, {graph_type}")
name_base = f"-{cluster_type}-{embed_type}-{ptr_type}-{brain_type}-{graph_type}"

fig, ax = plt.subplots(1, 1, figsize=(20, 30))
sankey(ax,
       class_labels,
       pred_labels,
       aspect=20,
       fontsize=16,
       colorDict=all_color_dict)
ax.axis("off")
ax.set_title(title, fontsize=30)

fig, ax = plt.subplots(1, 1, figsize=(20, 30))
sankey(ax,
       pred_labels,
       class_labels,
       aspect=20,
       fontsize=16,
       colorDict=all_color_dict)
ax.axis("off")
ax.set_title(title, fontsize=30)
Ejemplo n.º 4
0
    pred_labels = skmeans.fit_predict(latent)
    pred_labels = relabel(pred_labels)

    fig, ax = plt.subplots(2, 2, figsize=(30, 30))
    ax = ax.ravel()
    heatmap(
        binarize(adj),
        inner_hier_labels=pred_labels,
        # outer_hier_labels=side_labels,
        hier_label_fontsize=18,
        ax=ax[0],
        cbar=False,
        sort_nodes=True,
    )
    # uni_labels = np.unique(pred_labels)
    sankey(ax[1], class_labels, pred_labels)
    ax[1].axis("off")

    rand_perm = np.random.permutation(len(pred_labels))

    heatmap(
        binarize(adj),
        inner_hier_labels=pred_labels[rand_perm],
        # outer_hier_labels=side_labels,
        hier_label_fontsize=18,
        ax=ax[2],
        cbar=False,
        sort_nodes=True,
    )
    sankey(ax[3], class_labels, pred_labels[rand_perm])
    ax[3].axis("off")