Utils#

class pygod.utils.load_data(name, cache_dir=None)[source]#

Data loading function. See data repository for supported datasets. For injected/generated datasets, the labels meanings are as follows.

  • 0: inlier

  • 1: contextual outlier only

  • 2: structural outlier only

  • 3: both contextual outlier and structural outlier

Parameters
  • name (str) – The name of the dataset.

  • cache_dir (str, optional) – The directory for dataset caching. Default: None.

Returns

data – The outlier dataset.

Return type

torch_geometric.data.Data

Examples

>>> from pygod.utils import load_data
>>> data = load_data(name='weibo') # in PyG format
>>> y = data.y.bool()    # binary labels (inlier/outlier)
>>> yc = data.y >> 0 & 1 # contextual outliers
>>> ys = data.y >> 1 & 1 # structural outliers