YAML 规范
本文档描述了 OnDiskDataset
所使用的 metadata.yaml
文件的 YAML 规范。metadata.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
dataset_name
字段用于指定数据集的名称。它是用户自定义的。
graph
graph
字段用于指定图结构。它包含两个字段:nodes
和 edges
。
nodes
:list
nodes
字段用于指定每种节点类型的节点数量。它是一个node
对象列表。每个node
对象包含两个字段:type
和num
。
type
:string
, 可选
type
字段用于指定节点类型。对于同构图,该字段为null
。对于异构图,该字段为节点类型。
num
:int
num
字段用于指定该节点类型的节点数量。对于同构图和异构图,该字段都是必需的。
edges
:list
edges
字段用于指定边。它是一个edge
对象列表。每个edge
对象包含三个字段:type
、format
和path
。 -type
:string
, 可选
type
字段用于指定边类型。对于同构图,该字段为null
。对于异构图,该字段为边类型。
format
:string
format
字段用于指定边数据的格式。可以是csv
或numpy
。如果格式为csv
,则不需要index
和header
字段。如果格式为numpy
,数组的形状需要为(2, num_edges)
。对于大型图,推荐使用numpy
格式。
path
:string
path
字段用于指定边数据的路径。它是相对于metadata.yaml
文件所在目录的相对路径。
feature_data
feature_data
字段用于指定特征数据。它是一个 feature
对象列表。每个 feature
对象包含五个标准字段:domain
、type
、name
、format
和 path
。任何其他字段将传递给 Feature.metadata
对象。
domain
:string
domain
字段用于指定特征数据的域。可以是node
或edge
。
type
:string
, 可选
type
字段用于指定特征数据的类型。对于同构图,该字段为null
。对于异构图,该字段为节点或边类型。
name
:string
name
字段用于指定特征数据的名称。它是用户自定义的。
format
:string
format
字段用于指定特征数据的格式。可以是numpy
或torch
。
in_memory
:bool
, 可选
in_memory
字段用于指定是否将特征数据加载到内存中。可以是true
或false
。默认值为true
。
path
:string
path
字段用于指定特征数据的路径。它是相对于metadata.yaml
文件所在目录的相对路径。
tasks
tasks
字段用于指定任务。它是一个 task
对象列表。每个 task
对象至少包含三个字段:train_set
、validation_set
、test_set
。您可以自由添加其他字段,例如 num_classes
,所有这些字段都将传递给 Task.metadata
对象。
name
:string
, 可选
name
字段用于指定任务的名称。它是用户自定义的。
num_classes
:int
, 可选
num_classes
字段用于指定任务的类别数量。
train_set
:list
train_set
字段用于指定训练集。它是一个set
对象列表。每个set
对象包含两个字段:type
和data
。
type
:string
, 可选
type
字段用于指定集合的节点/边类型。对于同构图,该字段为null
。对于异构图,该字段为节点或边类型。
data
:list
data
字段用于加载train_set
。它是一个data
对象列表。每个data
对象包含四个字段:name
、format
、in_memory
和path
。
name
:string
name
字段用于指定数据的名称。它是必需的,并用于指定MiniBatch
中用于采样的字段。它可以是seeds
、labels
或indexes
。如果使用任何其他名称,它将被添加到MiniBatch
的数据字段中。
format
:string
format
字段用于指定数据的格式。可以是numpy
或torch
。
in_memory
:bool
, 可选
in_memory
字段用于指定是否将数据加载到内存中。可以是true
或false
。默认值为true
。
path
:string
path
字段用于指定数据的路径。它是相对于metadata.yaml
文件所在目录的相对路径。
validation_set
:list
test_set
:list
validation_set
和test_set
字段分别用于指定验证集和测试集。它们与train_set
字段类似。