MCPcopy Create free account
hub / github.com/easy-graph/Easy-Graph / LINE

Class LINE

easygraph/functions/graph_embedding/line.py:20–240  ·  view source on GitHub ↗

Graph embedding via LINE. Parameters ---------- G : easygraph.Graph or easygraph.DiGraph dimension: int walk_length: int walk_num: int negative: int batch_size: int init_alpha: float order: int Returns ------- embedding_vector : dict The

Source from the content-addressed store, hash-verified

18
19
20class LINE(nn.Module):
21 """Graph embedding via LINE.
22 Parameters
23 ----------
24 G : easygraph.Graph or easygraph.DiGraph
25 dimension: int
26 walk_length: int
27
28 walk_num: int
29
30 negative: int
31 batch_size: int
32
33 init_alpha: float
34 order: int
35 Returns
36 -------
37 embedding_vector : dict
38 The embedding vector of each node
39 Examples
40 --------
41 >>> model = LINE(
42 ... dimension=128,
43 ... walk_length=80,
44 ... walk_num=20,
45 ... negative=5,
46 ... batch_size=128,
47 ... init_alpha=0.025,
48 ... order=3 )
49 >>> model.train()
50 >>> emb = model(g, return_dict=True) # g: easygraph.Graph or easygraph.DiGraph
51
52 References
53 ----------
54
55 .. [1] Tang, J., Qu, M., Wang, M., Zhang, M., Yan, J., & Mei, Q. (2015, May). Line: Large-scale information network embedding. In Proceedings of the 24th international conference on world wide web (pp. 1067-1077).
56
57 https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/frp0228-Tang.pdf
58
59 """
60
61 @staticmethod
62 def add_args(parser):
63 """Add model-specific arguments to the parser."""
64 parser.add_argument(
65 "--walk-length",
66 type=int,
67 default=80,
68 help="Length of walk per source. Default is 80.",
69 )
70 parser.add_argument(
71 "--walk-num",
72 type=int,
73 default=20,
74 help="Number of walks per source. Default is 20.",
75 )
76 parser.add_argument(
77 "--negative",

Callers 2

line.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected