MCPcopy Index your code
hub / github.com/shenweichen/GraphEmbedding / main

Function main

examples/deepwalk_wiki.py:50–73  ·  view source on GitHub ↗
(smoke=False, show=True)

Source from the content-addressed store, hash-verified

48
49
50def main(smoke=False, show=True):
51 graph_path = SMOKE_GRAPH_PATH if smoke else WIKI_GRAPH_PATH
52 graph = nx.read_edgelist(
53 str(graph_path),
54 create_using=nx.DiGraph(),
55 nodetype=None,
56 data=[("weight", int)],
57 )
58
59 model = DeepWalk(
60 graph,
61 walk_length=3 if smoke else 10,
62 num_walks=2 if smoke else 80,
63 workers=1,
64 )
65 model.train(window_size=2 if smoke else 5, iter=1 if smoke else 3, workers=1)
66 embeddings = model.get_embeddings()
67 assert len(embeddings) > 0
68
69 if not smoke:
70 evaluate_embeddings(embeddings, WIKI_LABEL_PATH)
71 plot_embeddings(embeddings, WIKI_LABEL_PATH, show=show)
72
73 return embeddings
74
75
76if __name__ == "__main__":

Callers 1

deepwalk_wiki.pyFile · 0.70

Calls 5

trainMethod · 0.95
get_embeddingsMethod · 0.95
DeepWalkClass · 0.90
evaluate_embeddingsFunction · 0.70
plot_embeddingsFunction · 0.70

Tested by

no test coverage detected