Skip to content

Commit af9a973

Browse files
committed
Merge branch 'external_dataset' of https://github.com/snap-stanford/ogb into external_dataset
2 parents d5d382c + be6e828 commit af9a973

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

ogb/io/README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ The `DatasetSaver` class allows external contributors to prepare their datasets
55
Below is the quick example of how to use `DatasetSaver` class, where we focus on graph property prediction datasets.
66
Please follow the steps below **in the exact order** to generate final dataset files.
77

8-
## 0. Constructor
8+
## 1. Constructor
99
Create a constructor of `DatasetSaver`. `dataset_name` needs to follow OGB convention and start from either `ogbn-`, `ogbl-`, or `ogbg-`. `is_hetero` is `True` for heterogeneous graphs, and `version` indicates the dataset version.
1010
```python
1111
from ogb.io import DatasetSaver
@@ -18,13 +18,13 @@ dataset_name = 'ogbg-toy'
1818
saver = DatasetSaver(dataset_name = dataset_name, is_hetero = False, version = 1)
1919
```
2020

21-
## 1. Saving graph list
21+
## 2. Saving graph list
2222

2323
Create `graph_list`, storing your graph objects, and call `saver.save_graph_list(graph_list)`.
2424

2525
Graph objects are dictionaries containing the following keys.
2626
### Homogeneous graph:
27-
- `edge_index` (necessary): `numpy.ndarray` of shape `(2, num_edges)`. Includes bidirectional edges explicitly if graphs are undirected.
27+
- `edge_index` (necessary): `numpy.ndarray` of shape `(2, num_edges)`. Please include bidirectional edges explicitly if graphs are undirected.
2828
- `num_nodes` (necessary): `int`, denoting the number of nodes in the graph.
2929
- `node_feat` (optional): `numpy.ndarray` of shape `(num_nodes, node_feat_dim)`.
3030
- `edge_feat` (optional): `numpy.ndarray` of shape `(num_edges, edge_feat_dim)`.
@@ -33,7 +33,7 @@ Graph objects are dictionaries containing the following keys.
3333
- `edge_index_dict` (necessary): Dictionary mapping triplets `(head type, relation type, tail type)` to `edge_index`
3434
- `num_nodes_dict` (necessary): Dictionary mapping `entity type` to `num_nodes`.
3535
- `node_feat_dict` (optional): Dictionary mapping `entity type` to `node_feat`.
36-
- `edge_feat_dict` (optional): Dictionary mapping `entity type` to `edge_feat`.
36+
- `edge_feat_dict` (optional): Dictionary mapping `(head type, relation type, tail type)` to `edge_feat`.
3737

3838
```python
3939
# generate random graphs with node and edge features
@@ -89,17 +89,18 @@ saver.copy_mapping_dir(mapping_path)
8989
```
9090

9191
## 6. Saving task information
92-
Save task information by calling `saver.save_task_info(task_type = 'classification', eval_metric = 'acc', num_classes = num_classes)`.
92+
Save task information by calling `saver.save_task_info(task_type, eval_metric, num_classes = num_classes)`.
93+
`eval_metric` is used to call `Evaluator` (c.f. [here](https://github.com/snap-stanford/ogb/blob/master/ogb/graphproppred/evaluate.py)). You can reuse one of the existing metrics, or you can implement your own by creating a pull request.
9394
```python
9495
saver.save_task_info(task_type = 'classification', eval_metric = 'acc', num_classes = num_classes)
9596
```
9697

97-
## 7. Get meta information dictionary
98+
## 7. Getting meta information dictionary
9899
```python
99100
meta_dict = saver.get_meta_dict()
100101
```
101102

102-
## 8. Test the dataset object
103+
## 8. Testing the dataset object
103104
Test the OGB dataset object to confirm it is working as you expect. You can similarly test Pytorch Geometric and DGL dataset objects.
104105
```python
105106
from ogb.graphproppred import GraphPropPredDataset
@@ -110,11 +111,11 @@ print(dataset[0])
110111
print(dataset.get_idx_split())
111112
```
112113

113-
## 10. Zip and clean up
114+
## 9. Zipping and cleaning up
114115
```python
115116
saver.zip()
116117
saver.cleanup()
117118
```
118119

119-
## 11. Send us two files
120-
In this example, under `submission_ogbg_toy/`, you will find two files `meta_dict.pt` and `toy.zip`. Please send them to us.
120+
## 10. Sending us two files
121+
In this example, under `submission_ogbg_toy/`, you will find two files `meta_dict.pt` and `toy.zip`. Please send them to us.

0 commit comments

Comments
 (0)