You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/overview/getting_started.md
+87-5
Original file line number
Diff line number
Diff line change
@@ -116,7 +116,7 @@ Graph neural networks (GNNs) combines superiority of both graph analytics and ma
116
116
117
117
````{dropdown} Prepare data and engine for learning
118
118
119
-
In our example, we train a Graph Convolutional Network (GCN) model to classify the nodes (papers) into 349 categories, each representing a venue (e.g., pre-print or conference). To accomplish this, we first launch a learning engine and construct a graph with features, following the previous step.
119
+
In our example, we train a supervised GraphSAGE model to classify the nodes (papers) into 349 categories, each representing a venue (e.g., pre-print or conference). To accomplish this, we first launch a learning engine and construct a graph with features, following the previous step.
120
120
121
121
```python
122
122
# define the features for learning
@@ -153,8 +153,8 @@ from graphscope.learning.examples import EgoGraphSAGE
153
153
from graphscope.learning.examples import EgoSAGESupervisedDataLoader
154
154
from graphscope.learning.examples.tf.trainer import LocalTrainer
GNN model training with GraphScope is easy and straightforward. You can use the `graphscope` package to train a GNN model on your local machine. Note that
269
+
`tensorflow` is required to run the following example.
268
270
269
-
TODO(LiSu):
271
+
````{dropdown} Example: Training GraphSAGE Model in GraphScope
272
+
```python
273
+
274
+
import graphscope
275
+
from graphscope.dataset import load_ogbn_mag
276
+
277
+
g = load_ogbn_mag()
278
+
279
+
# define the features for learning
280
+
paper_features = [f"feat_{i}" for i in range(128)]
281
+
282
+
# launch a learning engine.
283
+
lg = graphscope.graphlearn(g, nodes=[("paper", paper_features)],
284
+
edges=[("paper", "cites", "paper")],
285
+
gen_labels=[
286
+
("train", "paper", 100, (0, 75)),
287
+
("val", "paper", 100, (75, 85)),
288
+
("test", "paper", 100, (85, 100))
289
+
])
290
+
291
+
try:
292
+
# https://www.tensorflow.org/guide/migrate
293
+
import tensorflow.compat.v1 as tf
294
+
tf.disable_v2_behavior()
295
+
except ImportError:
296
+
import tensorflow as tf
297
+
298
+
import graphscope.learning
299
+
from graphscope.learning.examples import EgoGraphSAGE
300
+
from graphscope.learning.examples import EgoSAGESupervisedDataLoader
301
+
from graphscope.learning.examples.tf.trainer import LocalTrainer
0 commit comments