<jupyter_start><jupyter_text>loading node2vec embeddings<jupyter_code>with open('gae/data/saved/node2vec/disease_weighted.emb') as f:
    embeddings = f.readlines()[1:]
embeddings.sort(key=lambda l: int(l.replace('\n', '').split(' ')[0]))
embeddings = [[float(n) for n in l.split(' ')] for l in embeddings]
node_list = [e[0] for e in embeddings]
embeddings = [e[1:] for e in embeddings]
embedding_matrix = np.stack(embeddings)
embedding_matrix.shape<jupyter_output><empty_output><jupyter_text>loading gmvae embeddings<jupyter_code>z = np.load('gae/data/saved/disease_network_z.npy')
z.shape
with open('gae/data/diseasome/node_list.txt') as f: 
    node_order = f.readlines()
node_order = [int(n.replace('\n', '')) for n in node_order]
# sorted z 
z = np.stack(sorted(zip(node_order, z.tolist()), key=lambda x: x[0]))
z = np.stack(list(zip(*z))[1])<jupyter_output><empty_output><jupyter_text>Dataframe<jupyter_code>import pandas as pd 

df = pd.DataFrame()
df['node2vec'] = embedding_matrix.tolist()
df['gmvae'] = z.tolist()
df = df.set_index(pd.Series(node_list))
df.head()<jupyter_output><empty_output><jupyter_text>tsne-plot<jupyter_code>from sklearn.manifold import TSNE

embeddings_tsne = TSNE(n_components=2).fit_transform(embedding_matrix)
embeddings_tsne.shape 
plt.figure(figsize=(16, 10))
sns.scatterplot(
    x=embeddings_tsne[:, 0], y=embeddings_tsne[:, 1],
    palette=sns.color_palette("hls", 10),
    legend='full', 
    alpha=0.5,
    color='red'
)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1667782987273945, 'fraction_numerical': 0.013395847287340924, 'mean_word_length': 6.821989528795812, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '450726', 'license': 'MIT', 'n_tokens_mistral': 619, 'n_tokens_neox': 588, 'n_words': 95, 'path': '.ipynb_checkpoints/explore_embeddings-checkpoint.ipynb', 'repo_name': 'EdoardoPona/gae', 'size': '1493'}