clefourrier HF staff commited on
Commit
5e8b497
1 Parent(s): a92331b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +132 -0
README.md CHANGED
@@ -1,3 +1,135 @@
1
  ---
2
  license: mit
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
  ---
4
+
5
+ # Dataset Card for ogbg-code2
6
+
7
+ ## Table of Contents
8
+ - [Table of Contents](#table-of-contents)
9
+ - [Dataset Description](#dataset-description)
10
+ - [Dataset Summary](#dataset-summary)
11
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
12
+ - [External Use](#external-use)
13
+ - [PyGeometric](#pygeometric)
14
+ - [Dataset Structure](#dataset-structure)
15
+ - [Data Properties](#data-properties)
16
+ - [Data Fields](#data-fields)
17
+ - [Data Splits](#data-splits)
18
+ - [Additional Information](#additional-information)
19
+ - [Licensing Information](#licensing-information)
20
+ - [Citation Information](#citation-information)
21
+ - [Contributions](#contributions)
22
+
23
+ ## Dataset Description
24
+
25
+ - **[Homepage](https://ogb.stanford.edu/docs/graphprop/#ogbg-code2)**
26
+ - **[Repository](https://github.com/snap-stanford/ogb):**:
27
+ - **Paper:**: Open Graph Benchmark: Datasets for Machine Learning on Graphs (see citation)
28
+ - **Leaderboard:**: [OGB leaderboard](https://ogb.stanford.edu/docs/leader_graphprop/#ogbg-code2) and [Papers with code leaderboard](https://paperswithcode.com/sota/graph-property-prediction-on-ogbg-code2)
29
+
30
+ ### Dataset Summary
31
+
32
+ The `ogbg-code2` dataset contains Abstract Syntax Trees (ASTs) obtained from 450 thousands Python method definitions, from GitHub CodeSearchNet. "Methods are extracted from a total of 13,587 different repositories across the most popular projects on GitHub.", by teams at Stanford, to be a part of the Open Graph Benchmark. See their website or paper for dataset postprocessing.
33
+
34
+ ### Supported Tasks and Leaderboards
35
+
36
+ "The task is to predict the sub-tokens forming the method name, given the Python method body represented by AST and its node features. This task is often referred to as “code summarization”, because the model is trained to find succinct and precise description for a complete logical unit."
37
+
38
+ The score is the F1 score of sub-token prediction.
39
+
40
+ ## External Use
41
+ ### PyGeometric
42
+ To load in PyGeometric, do the following:
43
+
44
+ ```python
45
+ from datasets import load_dataset
46
+
47
+ from torch_geometric.data import Data
48
+ from torch_geometric.loader import DataLoader
49
+
50
+ graphs_dataset = load_dataset("graphs-datasets/ogbg-code2)
51
+ # For the train set (replace by valid or test as needed)
52
+ graphs_list = [Data(graph) for graph in graphs_dataset["train"]]
53
+ graphs_pygeometric = DataLoader(graph_list)
54
+
55
+ ```
56
+
57
+
58
+ ## Dataset Structure
59
+
60
+ ### Data Properties
61
+
62
+ | property | value |
63
+ |---|---|
64
+ | scale | medium |
65
+ | #graphs | 452,741 |
66
+ | average #nodes | 125.2 |
67
+ | average #edges | 124.2 |
68
+ | average node degree | 2.0 |
69
+ | average cluster coefficient | 0.0 |
70
+ | MaxSCC ratio | 1.000 |
71
+ | graph diameter | 13.5 |
72
+
73
+ ### Data Fields
74
+
75
+ Each row of a given file is a graph, with:
76
+ - `edge_index` (list: 2 x #edges): pairs of nodes constituting edges
77
+ - `edge_feat` (list: #edges x #edge-features): features of edges
78
+ - `node_feat` (list: #nodes x #node-features): the nodes features, embedded
79
+ - `node_feat_expanded` (list: #nodes x #node-features): the nodes features, as code
80
+ - `node_is_attributed` (list: 1 x #nodes): ?
81
+ - `node_dfs_order` (list: #nodes x #1): the nodes order in the abstract tree, if parsed using a depth first search
82
+ - `node_depth` (list: #nodes x #1): the nodes depth in the abstract tree
83
+ - `y` (list: 1 x #tokens): contains the tokens to predict as method name
84
+ - `num_nodes` (int): number of nodes of the graph
85
+ - `ptr` (list: 2): index of first and last node of the graph
86
+ - `batch` (list: 1 x #nodes): ?
87
+
88
+ ### Data Splits
89
+
90
+ This data comes from the PyGeometric version of the dataset provided by OGB, and follows the provided data splits.
91
+ This information can be found back using
92
+ ```python
93
+ from ogb.graphproppred import PygGraphPropPredDataset
94
+
95
+ dataset = PygGraphPropPredDataset(name = 'ogbg-code2')
96
+
97
+ split_idx = dataset.get_idx_split()
98
+ train = dataset[split_idx['train']] # valid, test
99
+ ```
100
+
101
+ More information (`node_feat_expanded`) has been added through the typeidx2type and attridx2attr csv files of the repo.
102
+
103
+ ## Additional Information
104
+
105
+ ### Licensing Information
106
+ The dataset has been released under MIT license license.
107
+
108
+ ### Citation Information
109
+ ```
110
+ @inproceedings{hu-etal-2020-open,
111
+ author = {Weihua Hu and
112
+ Matthias Fey and
113
+ Marinka Zitnik and
114
+ Yuxiao Dong and
115
+ Hongyu Ren and
116
+ Bowen Liu and
117
+ Michele Catasta and
118
+ Jure Leskovec},
119
+ editor = {Hugo Larochelle and
120
+ Marc Aurelio Ranzato and
121
+ Raia Hadsell and
122
+ Maria{-}Florina Balcan and
123
+ Hsuan{-}Tien Lin},
124
+ title = {Open Graph Benchmark: Datasets for Machine Learning on Graphs},
125
+ booktitle = {Advances in Neural Information Processing Systems 33: Annual Conference
126
+ on Neural Information Processing Systems 2020, NeurIPS 2020, December
127
+ 6-12, 2020, virtual},
128
+ year = {2020},
129
+ url = {https://proceedings.neurips.cc/paper/2020/hash/fb60d411a5c5b72b2e7d3527cfc84fd0-Abstract.html},
130
+ }
131
+ ```
132
+
133
+ ### Contributions
134
+
135
+ Thanks to [@clefourrier](https://github.com/clefourrier) for adding this dataset.