easygraph.datasets.amazon_photo module#

class easygraph.datasets.amazon_photo.AmazonPhotoDataset(raw_dir=None, force_reload=False, verbose=True, transform=None)[source]#

Bases: EasyGraphBuiltinDataset

Amazon Electronics Photo co-purchase graph dataset.

Nodes represent products, and edges link products frequently co-purchased. Node features are bag-of-words of product reviews. The task is to classify the product category.

Statistics:

  • Nodes: 7,650

  • Edges: 119,081

  • Number of Classes: 8

  • Features: 745

Parameters:
  • raw_dir (str, optional) – Raw file directory to download/contains the input data directory. Default: None

  • force_reload (bool, optional) – Whether to reload the dataset. Default: False

  • verbose (bool, optional) – Whether to print out progress information. Default: True

  • transform (callable, optional) – A transform that takes in a Graph object and returns a transformed version. The Graph object will be transformed before every access.

Examples

>>> from easygraph.datasets import AmazonPhotoDataset
>>> dataset = AmazonPhotoDataset()
>>> g = dataset[0]
>>> print(g.number_of_nodes())
>>> print(g.number_of_edges())
>>> print(g.nodes[0]['feat'].shape)
>>> print(g.nodes[0]['label'])
>>> print(dataset.num_classes)
property num_classes#
process()[source]#

Overwrite to realize your own logic of processing the input data.