torch_geometric.datasets.BAMultiShapesDataset

class BAMultiShapesDataset(root: str, transform: Optional[Callable] = None, pre_transform: Optional[Callable] = None, pre_filter: Optional[Callable] = None, force_reload: bool = False)[source]

Bases: InMemoryDataset

The synthetic BA-Multi-Shapes graph classification dataset for evaluating explainabilty algorithms, as described in the “Global Explainability of GNNs via Logic Combination of Learned Concepts” paper.

Given three atomic motifs, namely House (H), Wheel (W), and Grid (G), BAMultiShapesDataset contains 1,000 graphs where each graph is obtained by attaching the motifs to a random Barabasi-Albert (BA) as follows:

  • class 0: \(\emptyset \lor H \lor W \lor G \lor \{ H, W, G \}\)

  • class 1: \((H \land W) \lor (H \land G) \lor (W \land G)\)

This dataset is pre-computed from the official implementation.

Parameters:
  • root (str) – Root directory where the dataset should be saved.

  • transform (callable, optional) – A function/transform that takes in an torch_geometric.data.Data object and returns a transformed version. The data object will be transformed before every access. (default: None)

  • pre_transform (callable, optional) – A function/transform that takes in an torch_geometric.data.Data object and returns a transformed version. The data object will be transformed before being saved to disk. (default: None)

  • pre_filter (callable, optional) – A function that takes in an torch_geometric.data.Data object and returns a boolean value, indicating whether the data object should be included in the final dataset. (default: None)

  • force_reload (bool, optional) – Whether to re-process the dataset. (default: False)

STATS:

#graphs

#nodes

#edges

#features

#classes

1000

40

~87.0

10

2