def stashskel(name, ids, colors, palette=None, **kws):
    if SAVESKELS:
        return export_skeleton_json(name,
                                    ids,
                                    colors,
                                    palette=palette,
                                    foldername=FNAME,
                                    **kws)
示例#2
0
sf = signal_flow(adj)

# %% [markdown]
# # Compute signal flow marginals for known cell types

signal_flow_marginal(adj, class_labels)
stashfig("known-class-sf-marginal")

# %% [markdown]
# # Write out signal flow as color for jsons

norm = colors.Normalize(vmin=sf.min(), vmax=sf.max())
sm = ScalarMappable(norm=norm, cmap="Reds")
cmap = sm.to_hex(sf)

export_skeleton_json("signal-flow", skeleton_labels, cmap, palette=None)

# # %% [markdown]
# # #
# node_signal_flow = signal_flow(adj)
# mean_sf = np.zeros(k)
# for i in np.unique(pred_labels):
#     inds = np.where(pred_labels == i)[0]
#     mean_sf[i] = np.mean(node_signal_flow[inds])

# cluster_mean_latent = gmm.model_.means_[:, 0]
# block_probs = SBMEstimator().fit(bin_adj, y=pred_labels).block_p_
# block_prob_df = pd.DataFrame(data=block_probs, index=range(k), columns=range(k))
# block_g = nx.from_pandas_adjacency(block_prob_df, create_using=nx.DiGraph)
# plt.figure(figsize=(10, 10))
# # don't ever let em tell you you're too pythonic
示例#3
0
plt.figure()
fg = sns.FacetGrid(data=out_df,
                   row="Metric",
                   col="Method",
                   margin_titles=True,
                   height=6)
fg.map(sns.lineplot, "K", "ARI")
plt.suptitle("ARI metrics", fontsize=40, y=1.03, verticalalignment="top")
stashfig("overall-ARI")

plt.figure()
fg = sns.FacetGrid(data=out_df,
                   col="Method",
                   margin_titles=True,
                   height=6,
                   sharey=False)
fg.map(sns.lineplot, x="K", y="Score")
plt.suptitle("Unsupervised score metrics",
             fontsize=40,
             y=1.05,
             verticalalignment="top")
stashfig("overall-score")

# %% [markdown]
# # Try exporting as JSON for CATMAID

out_path = "./maggot_models/notebooks/outs/30.0-BDP-mw-clustering/test_json.json"
export_skeleton_json(out_path, skeleton_labels, pred_labels, "deep")

# %%