NAS benchmark for graph data
Project description
NAS-Bench-Graph
This repository provides the official codes and all evaluated architectures for NAS-Bench-Graph, a tailored benchmark for graph neural architecture search.
Usage
First, read the benchmark of a certain dataset by specifying the name. The nine supported datasets are: cora, citeseer, pubmed, cs, physics, photo, computers, arxiv, and proteins. For example, for the Cora dataset:
from readbench import lightread
bench = lightread('cora')
The data is stored as a dict
in Python.
Then, an architecture needs to be specified by its macro space and operations. We consider the macro space as a directed acyclic graph (DAG) and constrain the DAG to have only one input node for each intermediate node. Therefore, the macro space can be specificed by a list of integers, indicating the input node index for each computing node (0 for the raw input, 1 for the first computing node, etc.). Then, the operations can be specified by a list of strings with the same length. For example, we provide the code to specify the architecture in the following figure:
from architecture import Arch
arch = Arch([0, 1, 2, 1], ['gcn', 'gin', 'fc', 'cheb'])
# 0 means the inital computing node is connected to the input node
# 1 means the next computing node is connected to the first computing node
# 2 means the next computing node is connected to the second computing node
# 1 means there is another computing node connected to the first computing node
Notice that we assume all leaf nodes (i.e., nodes without descendants) are connected to the output, so there is no need to specific the output node.
Besides, the list can be specified in any order, e.g., the following code can specific the same architecture:
arch = Arch([0, 1, 1, 2], ['gcn', 'cheb', 'gin', 'fc'])
The benchmark data can be obtained by a look-up table. In this repository, we only provide the validation and test performance, the latency, and the number of parameters as follows:
info = bench[arch.valid_hash()]
info['valid_perf'] # validation performance
info['perf'] # test performance
info['latency'] # latency
info['para'] # number of parameters
For the complete benchmark, please downloadfrom https://figshare.com/articles/dataset/NAS-bench-Graph/20070371, which contains the training/validation/testing performance at each epoch. Since we run each dataset with three random seeds, each dataset has 3 files, e.g.,
from readbench import read
bench = read('cora0.bench') # cora1.bench and cora2.bench
The full metric for any epoch can be obtained as follows.
info = bench[arch.valid_hash()]
epoch = 50
info['dur'][epoch][0] # training performance
info['dur'][epoch][1] # validation performance
info['dur'][epoch][2] # testing performance
info['dur'][epoch][3] # training loss
info['dur'][epoch][4] # validation loss
info['dur'][epoch][5] # testing loss
info['dur'][epoch][6] # best performance
Example usage of NNI and AutoGL
NAS-Bench-Graph can be used together with other libraries such AutoGL and NNI.
For the usage of AutoGL, please refer to the agnn branch.
You can also refer to runnni.py
to use the benchmark together with NNI.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file nas_bench_graph-1.4.0.tar.gz
.
File metadata
- Download URL: nas_bench_graph-1.4.0.tar.gz
- Upload date:
- Size: 5.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b034db88f52335a8a80f66c83faf42ff686cbea00b0bf62e7c0574e1edd8e75 |
|
MD5 | 38defb1db768fbf3085fb503edce7e86 |
|
BLAKE2b-256 | 94b0d857b5fe3e28990bcad5657bffce0c0e9f68f73ed225b67fa35af5c0d815 |
File details
Details for the file nas_bench_graph-1.4.0-py3-none-any.whl
.
File metadata
- Download URL: nas_bench_graph-1.4.0-py3-none-any.whl
- Upload date:
- Size: 5.9 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6ea43836262f1ee8d60c35bbbd20aa2536ee1f8492025e3b0b90096f5afc6ad |
|
MD5 | 602537aca8445cc9b5fc7ad1359563b1 |
|
BLAKE2b-256 | c00d3f638d82eb82c5f51164cbd4e255a7f9397fae633a0b4f8e111d97e98539 |