<jupyter_start><jupyter_text>Karate Club node embeddings* Code from https://towardsdatascience.com/a-beginners-guide-to-graph-neural-networks-using-pytorch-geometric-part-2-cd82c01330ab<jupyter_code>from ge import DeepWalk
import networkx as nx
import numpy as np

# load graph from networkx library
G = nx.karate_club_graph()

# convert nodes from int to str format
keys = np.arange(0,34)
values = [str(i) for i in keys]
dic = dict(zip(keys, values))
H = nx.relabel_nodes(G, dic)

# train the model and generate embeddings
model = DeepWalk(H, walk_length=10, num_walks=80, workers=1)
model.train(window_size=5,iter=3)

embeddings = model.get_embeddings()
embeddings["3"]
3<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.112375533428165, 'fraction_numerical': 0.02844950213371266, 'mean_word_length': 6.257731958762887, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '152482', 'license': 'MIT', 'n_tokens_mistral': 271, 'n_tokens_neox': 258, 'n_words': 62, 'path': 'Karate_club_1.ipynb', 'repo_name': 'PhotoWolf/Advanced_Grad_Seminar_GNN', 'size': '703'}