mindspore_gl.dataset.IMDBBinary

class mindspore_gl.dataset.IMDBBinary(root)[源代码]

IMDBBinary数据集,用于读取和解析IMDBBinary数据集的源数据集。

关于IMDBBinary数据集:

IMDBBinary数据集,用于读取和解析IMDBBinaary数据集的源数据集。IMDB-BINARY是一个电影协作数据集,由1000名在IMDB电影中扮演角色的演员组成的角色扮演网络组成。 在每个图中,节点表示演员/女演员,如果他们出现在同一部电影中,则它们之间有一条边。这些图来源于动作片和浪漫片。

信息统计:

  • 节点: 19773

  • 边: 193062

  • 图: 1000

  • 分类数: 2

  • 数据集切分:

    • Train: 800

    • Valid: 200

下载地址:https://ls11-www.cs.tu-dortmund.de/people/morris/graphkerneldatasets/IMDB-BINARY.zip 。 您可以将数据集文件组织到以下目录结构中,并通过 preprocess API读取。

.
├── IMDB-BINARY_A.txt
├── IMDB-BINARY_graph_indicator.txt
└── IMDB-BINARY_graph_labels.txt
参数:
  • root (str) - 包含imdb_binary_with_mask.npz的根目录的路径。

异常:
  • TypeError - 如果 root 不是str。

  • RuntimeError - 如果 root 不包含数据文件。

样例:

>>> from mindspore_gl.dataset.imdb_binary import IMDBBinary
>>> root = "path/to/imdb_binary"
>>> dataset = IMDBBinary(root)
property graph_count

图的总数。

返回:

int,图的数量。

样例:

>>> #dataset is an instance object of Dataset
>>> graph_count = dataset.graph_count
property graph_edges

累计图边数。

返回:

numpy.ndarray,累积边数组。

样例:

>>> #dataset is an instance object of Dataset
>>> val_mask = dataset.graph_edges
graph_feat(graph_idx)[源代码]

图上每个节点的特征。

参数:
  • graph_idx (int) - 图索引。

返回:

numpy.ndarray,图的节点特征。

样例:

>>> #dataset is an instance object of Dataset
>>> graph_feat = dataset.graph_feat(graph_idx)
property graph_label

图的标签。

返回:

numpy.ndarray,图标签数组。

样例:

>>> #dataset is an instance object of Dataset
>>> graph_label = dataset.graph_label
property graph_nodes

累计图节点数。

返回:

numpy.ndarray,累计节点数组。

样例:

>>> #dataset is an instance object of Dataset
>>> val_mask = dataset.graph_nodes
property node_feat

节点特征。

返回:

numpy.ndarray,节点特征数组。

样例:

>>> #dataset is an instance object of Dataset
>>> node_feat = dataset.node_feat
property num_classes

图标签种类。

返回:

int,图标签的种类。

样例:

>>> #dataset is an instance object of Dataset
>>> num_classes = dataset.num_classes
property num_edge_features

标签类数量。

返回:

int,类的数量。

样例:

>>> #dataset is an instance object of Dataset
>>> num_edge_features = dataset.num_edge_features
property num_features

每个节点的特征数量。

返回:

int,特征的数量。

样例:

>>> #dataset is an instance object of Dataset
>>> num_features = dataset.num_features
property train_graphs

训练图ID。

返回:

numpy.ndarray,训练图ID。

样例:

>>> #dataset is an instance object of Dataset
>>> train_graphs = dataset.train_graphs
property train_mask

训练节点掩码。

返回:

numpy.ndarray,掩码数组。

样例:

>>> #dataset is an instance object of Dataset
>>> train_mask = dataset.train_mask
property val_graphs

校验的图ID。

返回:

numpy.ndarray,校验图ID数组。

样例:

>>> #dataset is an instance object of Dataset
>>> val_graphs = dataset.val_graphs
property val_mask

校验节点掩码。

返回:

numpy.ndarray,掩码数组。

样例:

>>> #dataset is an instance object of Dataset
>>> val_mask = dataset.val_mask