torch_geometric.datasets.Amazon

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

Bases: InMemoryDataset

The Amazon Computers and Amazon Photo networks from the “Pitfalls of Graph Neural Network Evaluation” paper. Nodes represent goods and edges represent that two goods are frequently bought together. Given product reviews as bag-of-words node features, the task is to map goods to their respective product category.

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

  • name (str) – The name of the dataset ("Computers", "Photo").

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

  • pre_transform (Optional[Callable], default: None) – 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.

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

STATS:

Name

#nodes

#edges

#features

#classes

Computers

13,752

491,722

767

10

Photo

7,650

238,162

745

8