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

Function main

examples/line_wiki.py:56–74  ·  view source on GitHub ↗
(smoke=False, show=True)

Source from the content-addressed store, hash-verified

54
55
56def main(smoke=False, show=True):
57 graph_path = SMOKE_GRAPH_PATH if smoke else WIKI_GRAPH_PATH
58 graph = nx.read_edgelist(
59 str(graph_path),
60 create_using=nx.DiGraph(),
61 nodetype=None,
62 data=[("weight", int)],
63 )
64
65 model = LINE(graph, embedding_size=8 if smoke else 128, order="second")
66 model.train(batch_size=2 if smoke else 1024, epochs=1 if smoke else 50, verbose=0 if smoke else 2)
67 embeddings = model.get_embeddings()
68 assert len(embeddings) > 0
69
70 if not smoke:
71 evaluate_embeddings(embeddings, WIKI_LABEL_PATH)
72 plot_embeddings(embeddings, WIKI_LABEL_PATH, show=show)
73
74 return embeddings
75
76
77if __name__ == "__main__":

Callers 1

line_wiki.pyFile · 0.70

Calls 5

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

Tested by

no test coverage detected