"vscode:/vscode.git/clone" did not exist on "e062110b286ba0673d773588d70a8d41994086f2"
ondisk-dataset.rst 23.6 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
.. _graphbolt-ondisk-dataset:

Prepare dataset
===============

**GraphBolt** provides the ``OnDiskDataset`` class to help user organize plain
data of graph strucutre, feature data and tasks. ``OnDiskDataset`` is also
designed to efficiently handle large graphs and features that do not fit into
memory by storing them on disk.

To create an ``OnDiskDataset`` object, you need to organize all the data including
graph structure, feature data and tasks into a directory. The directory should
contain a ``metadata.yaml`` file that describes the metadata of the dataset.

Then just pass the directory path to the ``OnDiskDataset`` constructor to create
the dataset object.

.. code:: python

    from dgl.graphbolt import OnDiskDataset

    dataset = OnDiskDataset('/path/to/dataset')

The returned ``dataset`` object just loads the yaml file and does not load any
data. To load the graph structure, feature data and tasks, you need to call
the ``load`` method.

.. code:: python

    dataset.load()

The reason why we separate the ``OnDiskDataset`` object creation and data loading
is that you may want to change some fields in the ``metadata.yaml`` file before
loading the data. For example, you may want to change the path of the feature
data files to point to a different directory. In this case, you can just
modify the path via ``dataset.yaml_data`` directly. Then call the ``load`` method
again to load the data.

After loading the data, you can access the graph structure, feature data and
tasks through the ``graph``, ``feature`` and ``tasks`` attributes respectively.

.. code:: python

    graph = dataset.graph
    feature = dataset.feature
    tasks = dataset.tasks

The returned ``graph`` is a ``FusedCSCSamplingGraph`` object, which will be used
for sampling. The returned ``feature`` is a ``TorchBasedFeatureStore`` object,
which will be used for feature lookup. The returned ``tasks`` is a list of
``Task`` objects, which will be used for training and evaluation.

The following examples show data folder structure and ``metadata.yaml`` file for
homogeneous graphs and heterogeneous graphs respectively. If you want to know
the full YAML specification, please refer to the `Full YAML specification`_ section.

Homogeneous graph
-----------------

Data folder structure:
^^^^^^^^^^^^^^^^^^^^^

.. code::

    data/
      node_feat.npy
      edge_feat.npy
    edges/
      edges.csv
    set_nc/
      train_seed_nodes.npy
      train_labels.npy
      val_seed_nodes.npy
      val_labels.npy
      test_seed_nodes.npy
      test_labels.npy
    set_lp/
      train_node_pairs.npy
      val_node_pairs.npy
      val_negative_dsts.npy
      test_node_pairs.npy
      test_negative_dsts.npy
    metadata.yaml


``metadata.yaml`` file:
^^^^^^^^^^^^^^^^^^^^^

.. code:: yaml

    dataset_name: homogeneous_graph_nc_lp
    graph:
      nodes:
        - num: 10
      edges:
        - format: csv
          path: edges/edges.csv
    feature_data:
      - domain: node
        name: feat
        format: numpy
        in_memory: true
        path: data/node_feat.npy
      - domain: edge
        name: feat
        format: numpy
        in_memory: true
        path: data/edge_feat.npy
    tasks:
      - name: node_classification
        num_classes: 2
        train_set:
          - data:
              - name: seed_nodes
                format: numpy
                in_memory: true
                path: set_nc/train_seed_nodes.npy
              - name: labels
                format: numpy
                in_memory: true
                path: set_nc/train_labels.npy
        validation_set:
          - data:
              - name: seed_nodes
                format: numpy
                in_memory: true
                path: set_nc/val_seed_nodes.npy
              - name: labels
                format: numpy
                in_memory: true
                path: set_nc/val_labels.npy
        test_set:
          - data:
              - name: seed_nodes
                format: numpy
                in_memory: true
                path: set_nc/test_seed_nodes.npy
              - name: labels
                format: numpy
                in_memory: true
                path: set_nc/test_labels.npy
      - name: link_prediction
        num_classes: 2
        train_set:
          - data:
              - name: node_pairs
                format: numpy
                in_memory: true
                path: set_lp/train_node_pairs.npy
        validation_set:
          - data:
              - name: node_pairs
                format: numpy
                in_memory: true
                path: set_lp/val_node_pairs.npy
              - name: negative_dsts
                format: numpy
                in_memory: true
                path: set_lp/val_negative_dsts.npy
        test_set:
          - data:
              - name: node_pairs
                format: numpy
                in_memory: true
                path: set_lp/test_node_pairs.npy
              - name: negative_dsts
                format: numpy
                in_memory: true
                path: set_lp/test_negative_dsts.npy


For the graph structure, number of nodes is specified by the ``num`` field and
edges are stored in a csv file in format of ``<src, dst>`` like below.

.. code:: csv

    edges.csv

    0,1
    1,2
    2,3
    3,4
    4,5
    5,6
    6,7
    7,8
    8,9


For the feature data, we have feature data named as ``feat`` for nodes and
edges. The feature data are stored in numpy files in shape of ``[num_nodes, 10]``
and ``[num_edges, 10]`` respectively like below.

.. code:: python

    node_feat.npy

    array([[0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
           [1., 1., 1., 1., 1., 1., 1., 1., 1., 1.],
           [2., 2., 2., 2., 2., 2., 2., 2., 2., 2.],
           [3., 3., 3., 3., 3., 3., 3., 3., 3., 3.],
           [4., 4., 4., 4., 4., 4., 4., 4., 4., 4.],
           [5., 5., 5., 5., 5., 5., 5., 5., 5., 5.],
           [6., 6., 6., 6., 6., 6., 6., 6., 6., 6.],
           [7., 7., 7., 7., 7., 7., 7., 7., 7., 7.],
           [8., 8., 8., 8., 8., 8., 8., 8., 8., 8.],
           [9., 9., 9., 9., 9., 9., 9., 9., 9., 9.]])

    edge_feat.npy

    array([[0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
           [1., 1., 1., 1., 1., 1., 1., 1., 1., 1.],
           [2., 2., 2., 2., 2., 2., 2., 2., 2., 2.],
           [3., 3., 3., 3., 3., 3., 3., 3., 3., 3.],
           [4., 4., 4., 4., 4., 4., 4., 4., 4., 4.],
           [5., 5., 5., 5., 5., 5., 5., 5., 5., 5.],
           [6., 6., 6., 6., 6., 6., 6., 6., 6., 6.],
           [7., 7., 7., 7., 7., 7., 7., 7., 7., 7.],
           [8., 8., 8., 8., 8., 8., 8., 8., 8., 8.],
           [9., 9., 9., 9., 9., 9., 9., 9., 9., 9.]])


For the ``tasks`` field, we have two tasks: ``node_classification`` and
``link_prediction``. For each task, we have three sets: ``train_set``,
``validation_set`` and ``test_set``.

For ``node_classification`` task, we have two fields: ``seed_nodes`` and
``labels``. The ``seed_nodes`` field is used to specify the node IDs for
training and evaluation. The ``labels`` field is used to specify the
labels. Both of them are stored in numpy files with shape of ``[num_nodes]``
like below.

.. code:: python

    train_seed_nodes.npy

    array([0, 1, 2, 3, 4, 5])

    train_labels.npy

    array([0, 1, 0, 1, 0, 1])

    val_seed_nodes.npy

    array([6, 7])

    val_labels.npy

    array([0, 1])

    test_seed_nodes.npy

    array([8, 9])

    test_labels.npy

    array([0, 1])


For ``link_prediction`` task, we have two fields: ``node_pairs``,
``negative_dsts``.  The ``node_pairs`` field is used to specify the node pairs.
The ``negative_dsts`` field is used to specify the negative destination nodes.
They are stored in numpy file with shape of ``[num_edges, 2]`` and
``[num_edges, num_neg_dsts]`` respectively like below.

.. code:: python

    train_node_pairs.npy

    array([[0, 1],
           [1, 2],
           [2, 3],
           [3, 4],
           [4, 5],
           [5, 6]])

    val_node_pairs.npy

    array([[6, 7],
           [7, 8]])

    val_negative_dsts.npy

    array([[8, 9],
           [8, 9]])

    test_node_pairs.npy

    array([[8, 9],
           [9, 0]])

    test_negative_dsts.npy

    array([[0, 1],
           [0, 1]])


.. note::

    The values of ``name`` fields in the ``task`` such as ``seed_nodes``,
    ``labels``, ``node_pairs`` and ``negative_dsts`` are mandatory. They are
    used to specify the data fields of ``MiniBatch`` for sampling. The values
    of ``name`` fields in the ``feature_data`` such as ``feat`` are user-defined.


Heterogeneous graph
-----------------

Data folder structure:
^^^^^^^^^^^^^^^^^^^^^

.. code::

    data/
      user_feat.npy
      item_feat.npy
      user_follow_user_feat.npy
      user_click_item_feat.npy
    edges/
      user_follow_user.csv
      user_click_item.csv
    set_nc/
      user_train_seed_nodes.npy
      user_train_labels.npy
      user_val_seed_nodes.npy
      user_val_labels.npy
      user_test_seed_nodes.npy
      user_test_labels.npy
    set_lp/
      follow_train_node_pairs.npy
      follow_val_node_pairs.npy
      follow_val_negative_dsts.npy
      follow_test_node_pairs.npy
      follow_test_negative_dsts.npy
    metadata.yaml


``metadata.yaml`` file:
^^^^^^^^^^^^^^^^^^^^^

.. code:: yaml

    dataset_name: heterogeneous_graph_nc_lp
    graph:
      nodes:
        - type: user
          num: 10
        - type: item
          num: 10
      edges:
        - type: "user:follow:user"
          format: csv
          path: edges/user_follow_user.csv
        - type: "user:click:item"
          format: csv
          path: edges/user_click_item.csv
    feature_data:
      - domain: node
        type: user
        name: feat
        format: numpy
        in_memory: true
        path: data/user_feat.npy
      - domain: node
        type: item
        name: feat
        format: numpy
        in_memory: true
        path: data/item_feat.npy
      - domain: edge
        type: "user:follow:user"
        name: feat
        format: numpy
        in_memory: true
        path: data/user_follow_user_feat.npy
      - domain: edge
        type: "user:click:item"
        name: feat
        format: numpy
        in_memory: true
        path: data/user_click_item_feat.npy
    tasks:
      - name: node_classification
        num_classes: 2
        train_set:
          - type: user
            data:
              - name: seed_nodes
                format: numpy
                in_memory: true
                path: set/user_train_seed_nodes.npy
              - name: labels
                format: numpy
                in_memory: true
                path: set/user_train_labels.npy
        validation_set:
          - type: user
            data:
              - name: seed_nodes
                format: numpy
                in_memory: true
                path: set/user_val_seed_nodes.npy
              - name: labels
                format: numpy
                in_memory: true
                path: set/user_val_labels.npy
        test_set:
          - type: user
            data:
              - name: seed_nodes
                format: numpy
                in_memory: true
                path: set/user_test_seed_nodes.npy
              - name: labels
                format: numpy
                in_memory: true
                path: set/user_test_labels.npy
      - name: link_prediction
        num_classes: 2
        train_set:
          - type: "user:follow:user"
            data:
              - name: node_pairs
                format: numpy
                in_memory: true
                path: set/follow_train_node_pairs.npy
        validation_set:
          - type: "user:follow:user"
            data:
              - name: node_pairs
                format: numpy
                in_memory: true
                path: set/follow_val_node_pairs.npy
              - name: negative_dsts
                format: numpy
                in_memory: true
                path: set/follow_val_negative_dsts.npy
        test_set:
          - type: "user:follow:user"
            data:
              - name: node_pairs
                format: numpy
                in_memory: true
                path: set/follow_test_node_pairs.npy
              - name: negative_dsts
                format: numpy
                in_memory: true
                path: set/follow_test_negative_dsts.npy

For the graph structure, we have two types of nodes: ``user`` and ``item``
in above example. Number of each node type is specified by the ``num`` field.
We have two types of edges: ``user:follow:user`` and ``user:click:item``.
The edges are stored in two columns of csv files like below.

.. code:: csv

    user_follow_user.csv

    0,1
    1,2
    2,3
    3,4
    4,5
    5,6
    6,7
    7,8
    8,9

    user_click_item.csv

    0,0
    1,1
    2,2
    3,3
    4,4
    5,5
    6,6
    7,7
    8,8
    9,9

For the feature data, we have feature data named as ``feat`` for nodes and
edges. The feature data are stored in numpy files in shape of ``[num_nodes, 10]``
and ``[num_edges, 10]`` respectively like below.

.. code:: python

    user_feat.npy

    array([[0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
           [1., 1., 1., 1., 1., 1., 1., 1., 1., 1.],
           [2., 2., 2., 2., 2., 2., 2., 2., 2., 2.],
           [3., 3., 3., 3., 3., 3., 3., 3., 3., 3.],
           [4., 4., 4., 4., 4., 4., 4., 4., 4., 4.],
           [5., 5., 5., 5., 5., 5., 5., 5., 5., 5.],
           [6., 6., 6., 6., 6., 6., 6., 6., 6., 6.],
           [7., 7., 7., 7., 7., 7., 7., 7., 7., 7.],
           [8., 8., 8., 8., 8., 8., 8., 8., 8., 8.],
           [9., 9., 9., 9., 9., 9., 9., 9., 9., 9.]])

    item_feat.npy

    array([[0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
           [1., 1., 1., 1., 1., 1., 1., 1., 1., 1.],
           [2., 2., 2., 2., 2., 2., 2., 2., 2., 2.],
           [3., 3., 3., 3., 3., 3., 3., 3., 3., 3.],
           [4., 4., 4., 4., 4., 4., 4., 4., 4., 4.],
           [5., 5., 5., 5., 5., 5., 5., 5., 5., 5.],
           [6., 6., 6., 6., 6., 6., 6., 6., 6., 6.],
           [7., 7., 7., 7., 7., 7., 7., 7., 7., 7.],
           [8., 8., 8., 8., 8., 8., 8., 8., 8., 8.],
           [9., 9., 9., 9., 9., 9., 9., 9., 9., 9.]])

    user_follow_user_feat.npy

    array([[0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
           [1., 1., 1., 1., 1., 1., 1., 1., 1., 1.],
           [2., 2., 2., 2., 2., 2., 2., 2., 2., 2.],
           [3., 3., 3., 3., 3., 3., 3., 3., 3., 3.],
           [4., 4., 4., 4., 4., 4., 4., 4., 4., 4.],
           [5., 5., 5., 5., 5., 5., 5., 5., 5., 5.],
           [6., 6., 6., 6., 6., 6., 6., 6., 6., 6.],
           [7., 7., 7., 7., 7., 7., 7., 7., 7., 7.],
           [8., 8., 8., 8., 8., 8., 8., 8., 8., 8.],
           [9., 9., 9., 9., 9., 9., 9., 9., 9., 9.]])

    user_click_item_feat.npy

    array([[0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
           [1., 1., 1., 1., 1., 1., 1., 1., 1., 1.],
           [2., 2., 2., 2., 2., 2., 2., 2., 2., 2.],
           [3., 3., 3., 3., 3., 3., 3., 3., 3., 3.],
           [4., 4., 4., 4., 4., 4., 4., 4., 4., 4.],
           [5., 5., 5., 5., 5., 5., 5., 5., 5., 5.],
           [6., 6., 6., 6., 6., 6., 6., 6., 6., 6.],
           [7., 7., 7., 7., 7., 7., 7., 7., 7., 7.],
           [8., 8., 8., 8., 8., 8., 8., 8., 8., 8.],
           [9., 9., 9., 9., 9., 9., 9., 9., 9., 9.]])


For the ``tasks`` field, we have two tasks: ``node_classification`` and
``link_prediction``. For each task, we have three sets: ``train_set``,
``validation_set`` and ``test_set``.

For ``node_classification`` task, we have two fields: ``seed_nodes`` and
``labels``. The ``seed_nodes`` field is used to specify the node IDs for
training and evaluation. The ``labels`` field is used to specify the
labels. Both of them are stored in numpy files with shape of ``[num_nodes]``
like below.

.. code:: python

    user_train_seed_nodes.npy

    array([0, 1, 2, 3, 4, 5]])

    user_train_labels.npy

    array([0, 1, 0, 1, 0, 1])

    user_val_seed_nodes.npy

    array([6, 7])

    user_val_labels.npy

    array([0, 1])

    user_test_seed_nodes.npy

    array([8, 9])

    user_test_labels.npy

    array([0, 1])


For ``link_prediction`` task, we have two fields: ``node_pairs``,
``negative_dsts``.  The ``node_pairs`` field is used to specify the node pairs.
The ``negative_dsts`` field is used to specify the negative destination nodes.
They are stored in numpy file with shape of ``[num_edges, 2]`` and
``[num_edges, num_neg_dsts]`` respectively like below.

.. code:: python

    follow_train_node_pairs.npy

    array([[0, 1]
           [1, 2]
           [2, 3]
           [3, 4]
           [4, 5]
           [5, 6]]])

    follow_val_node_pairs.npy

    array([[6, 7]
           [7, 8]])

    follow_val_negative_dsts.npy

    array([[8, 9]
           [8, 9]]])

    follow_test_node_pairs.npy

    array([[8, 9]
           [9, 0]]])

    follow_test_negative_dsts.npy

    array([[0, 1]
           [0, 1]]])


Full YAML specification
-----------------------

The full YAML specification of ``metadata.yaml`` file is shown below.

.. code:: yaml

    dataset_name: <string>
    graph:
      nodes:
        - type: <string>
          num: <int>
        - type: <string>
          num: <int>
      edges:
        - type: <string>
          format: <string>
          path: <string>
        - type: <string>
          format: <string>
          path: <string>
    feature_data:
      - domain: node
        type: <string>
        name: <string>
        format: <string>
        in_memory: <bool>
        path: <string>
      - domain: node
        type: <string>
        name: <string>
        format: <string>
        in_memory: <bool>
        path: <string>
      - domain: edge
        type: <string>
        name: <string>
        format: <string>
        in_memory: <bool>
        path: <string>
      - domain: edge
        type: <string>
        name: <string>
        format: <string>
        in_memory: <bool>
        path: <string>
    tasks:
      - name: <string>
        num_classes: <int>
        train_set:
          - type: <string>
            data:
              - name: <string>
                format: <string>
                in_memory: <bool>
                path: <string>
              - name: <string>
                format: <string>
                in_memory: <bool>
                path: <string>
        validation_set:
          - type: <string>
            data:
              - name: <string>
                format: <string>
                in_memory: <bool>
                path: <string>
              - name: <string>
                format: <string>
                in_memory: <bool>
                path: <string>
        test_set:
          - type: <string>
            data:
              - name: <string>
                format: <string>
                in_memory: <bool>
                path: <string>
              - name: <string>
                format: <string>
                in_memory: <bool>
                path: <string>

``dataset_name``
^^^^^^^^^^^^^^^

The ``dataset_name`` field is used to specify the name of the dataset. It is
user-defined.

``graph``
^^^^^^^^

The ``graph`` field is used to specify the graph structure. It has two fields:
``nodes`` and ``edges``.

 - ``nodes``: ``list``

   The ``nodes`` field is used to specify the number of nodes for each node type.
   It is a list of ``node`` objects. Each ``node`` object has two fields: ``type``
   and ``num``.
    - ``type``: ``string``, optional

      The ``type`` field is used to specify the node type. It is ``null`` for
      homogeneous graphs. For heterogeneous graphs, it is the node type.
    - ``num``: ``int``

      The ``num`` field is used to specify the number of nodes for the node type.
      It is mandatory for both homogeneous graphs and heterogeneous graphs.

  - ``edges``: ``list``

    The ``edges`` field is used to specify the edges. It is a list of ``edge``
    objects. Each ``edge`` object has three fields: ``type``, ``format`` and
    ``path``.
    - ``type``: ``string``, optional

      The ``type`` field is used to specify the edge type. It is ``null`` for
      homogeneous graphs. For heterogeneous graphs, it is the edge type.
    - ``format``: ``string``

      The ``format`` field is used to specify the format of the edge data. It can
      only be ``csv`` for now.
    - ``path``: ``string``

      The ``path`` field is used to specify the path of the edge data. It is
      relative to the directory of ``metadata.yaml`` file.


``feature_data``
^^^^^^^^^^^^^^^

The ``feature_data`` field is used to specify the feature data. It is a list of
``feature`` objects. Each ``feature`` object has five fields: ``domain``, ``type``,
``name``, ``format`` and ``path``.

 - ``domain``: ``string``

   The ``domain`` field is used to specify the domain of the feature data. It can
   be either ``node`` or ``edge``.
 - ``type``: ``string``, optional

   The ``type`` field is used to specify the type of the feature data. It is
   ``null`` for homogeneous graphs. For heterogeneous graphs, it is the node or
   edge type.
  - ``name``: ``string``

    The ``name`` field is used to specify the name of the feature data. It is
    user-defined.
  - ``format``: ``string``

    The ``format`` field is used to specify the format of the feature data. It can
    be either ``numpy`` or ``torch``.
  - ``in_memory``: ``bool``, optional

    The ``in_memory`` field is used to specify whether the feature data is loaded
    into memory. It can be either ``true`` or ``false``. Default is ``true``.
  - ``path``: ``string``

    The ``path`` field is used to specify the path of the feature data. It is
    relative to the directory of ``metadata.yaml`` file.


``tasks``
^^^^^^^^

The ``tasks`` field is used to specify the tasks. It is a list of ``task``
objects. Each ``task`` object has at least three fields: ``train_set``,
``validation_set``, ``test_set``. And you are free to add other fields
such as ``num_classes`` and all these fields will be passed to the
``Task.metadata`` object.

 - ``name``: ``string``, optional

   The ``name`` field is used to specify the name of the task. It is user-defined.
 - ``num_classes``: ``int``, optional

    The ``num_classes`` field is used to specify the number of classes of the task.
 - ``train_set``: ``list``

    The ``train_set`` field is used to specify the training set. It is a list of
    ``set`` objects. Each ``set`` object has two fields: ``type`` and ``data``.
  - ``type``: ``string``, optional

      The ``type`` field is used to specify the node/edge type of the set. It is
      ``null`` for homogeneous graphs. For heterogeneous graphs, it is the node
      or edge type.
  - ``data``: ``list``

      The ``data`` field is used to load ``train_set``. It is a list of ``data``
      objects. Each ``data`` object has four fields: ``name``, ``format``,
      ``in_memory`` and ``path``.

    - ``name``: ``string``

        The ``name`` field is used to specify the name of the data. It is mandatory
        and used to specify the data fields of ``MiniBatch`` for sampling. It can
        be either ``seed_nodes``, ``labels``, ``node_pairs``, ``negative_srcs`` or 
        ``negative_dsts``. If any other name is used, it will be added into the
        ``MiniBatch`` data fields.
    - ``format``: ``string``

        The ``format`` field is used to specify the format of the data. It can be
        either ``numpy`` or ``torch``.
    - ``in_memory``: ``bool``, optional

        The ``in_memory`` field is used to specify whether the data is loaded into
        memory. It can be either ``true`` or ``false``. Default is ``true``.
    - ``path``: ``string``

        The ``path`` field is used to specify the path of the data. It is relative
        to the directory of ``metadata.yaml`` file.
 - ``validation_set``: ``list``
 - ``test_set``: ``list``

    The ``validation_set`` and ``test_set`` fields are used to specify the
    validation set and test set respectively. They are similar to the
    ``train_set`` field.