Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
acezen committed Jan 18, 2022
1 parent 9140bbd commit f1ffcdd
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions python/graphscope/learning/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,19 @@ def __init__(self, session, graph, nodes=None, edges=None, gen_labels=None):
session (:class:`Session`): instance of GraphScope session.
graph (:class:`graphscope.framework.graph.GraphDAGNode`):
Source property graph.
nodes (list, optional): list of node types that will be used for gnn training, the element of list
can be `node_label` or `(node_label, features)`. If the element of list
is a tuple and contains selected feature list, it would use the selected feature list for training.
if nodes is None, use all type of nodes and features for the gnn training.
edges (list, optional): list of edge types that will be used for gnn training. we use `(src_label, edge_label, dst_label)`
to specify one edge type. if edges is None, use all type of edges for gnn training.
gen_labels (list, optional): Alias node and edge labels and extract train/validation/test dataset
from original graph for supervised gnn training. We will explains the details in the examples.
nodes (list, optional): list of node types that will be used for gnn
training, the element of list can be `node_label` or
`(node_label, features)`. If the element of list is a tuple and
contains selected feature list, it would use the selected
feature list for training. if nodes is None, use all type of
nodes and features for the gnn training.
edges (list, optional): list of edge types that will be used for gnn
training. we use `(src_label, edge_label, dst_label)`
to specify one edge type. if edges is None, use all type of
edges for gnn training.
gen_labels (list, optional): Alias node and edge labels and extract
train/validation/test dataset from original graph for supervised
gnn training. We will explains the details in the examples.
Examples
--------
Expand All @@ -74,9 +79,12 @@ def __init__(self, session, graph, nodes=None, edges=None, gen_labels=None):
nodes=[("paper", features)]) # use "paper" node and features for training
edges=[("paper", "links", "paper")] # use the `paper->links->papers` edge type for training
gen_labels=[
("train", "paper", 100, (0, 75)), # cuts "paper" nodes into 100 pieces, and uses random 75 pieces(75%) as traning dataset.
("val", "paper", 100, (75, 85)), # cuts "paper" nodes into 100 pieces, and uses random 10 pieces(10%) as validation dataset.
("test", "paper", 100, (85, 100)), # cuts "paper" nodes into 100 pieces, and uses random 15 pieces(15%) as test dataset.
# cuts "paper" nodes into 100 pieces, and uses random 75 pieces(75%) as traning dataset.
("train", "paper", 100, (0, 75)),
# cuts "paper" nodes into 100 pieces, and uses random 10 pieces(10%) as validation dataset.
("val", "paper", 100, (75, 85)),
# cuts "paper" nodes into 100 pieces, and uses random 15 pieces(15%) as test dataset.
("test", "paper", 100, (85, 100)),
]
)
Notes that the train, validation and test dataset are not overlapping. And for unsupervised learning
Expand All @@ -85,8 +93,9 @@ def __init__(self, session, graph, nodes=None, edges=None, gen_labels=None):
nodes=[("paper", features)]) # use "paper" node and features for training
edges=[("paper", "links", "paper")] # use the `paper->links->papers` edge type for training
gen_labels=[
("train", "paper", 100, (0, 100)), # cuts "paper" nodes into 100 pieces, and uses all pieces as traning dataset and just alias "paper" to "train".
]
# cuts "paper" nodes into 100 pieces, and uses all pieces as traning dataset
# and just alias "paper" to "train".
("train", "paper", 100, (0, 100)),
"""
self._session = session
self._graph = graph
Expand Down

0 comments on commit f1ffcdd

Please sign in to comment.