SquirrelDataset(root, name, transform=None, pre_transform=None, pre_filter=None)

Bases: InMemoryDataset

Squirrel social network dataset loader for graph-based analysis.

Parameters:
  • root (str) –

    Root directory where the dataset should be saved

  • name (str) –

    Name of the squirrel dataset

  • transform (callable, default: None ) –

    Function/transform that takes in a Data object and returns a transformed version. Default: None

  • pre_transform (callable, default: None ) –

    Function/transform to be applied to the data object before saving. Default: None

  • pre_filter (callable, default: None ) –

    Function that takes in a Data object and returns a boolean value, indicating whether the data object should be included. Default: None

Notes

Dataset Structure:

  • Nodes represent Wikipedia pages about squirrels
  • Edges represent mutual links between pages
  • Node features from page attributes
  • Labels indicate page categories
  • Includes train/val/test splits (80/10/10)
processed_file_names property

Names of processed data files.

Returns:
  • list[str]

    List of processed file names

Notes

Processed files:

  • data.pt: Contains processed PyTorch Geometric data object
raw_file_names property

Names of required raw files.

Returns:
  • list[str]

    List of required raw file names

Notes

Required files:

  • data.mat: MATLAB file containing network data, attributes, and groups
download()

Download raw data files.

Notes

Empty implementation - data should be manually placed in raw directory

load_dataset()

Load raw MATLAB dataset file.

Returns:
  • tuple[ndarray, ndarray, ndarray]

    Contains:

    • X: Node attributes matrix (dense)
    • A: Adjacency matrix
    • Y: Node labels (converted from one-hot)
Notes
  • Loads .mat file containing network structure
  • Converts sparse attributes to dense matrix
  • Converts one-hot labels to class indices
process()

Process raw data into PyTorch Geometric Data format.

Notes

Processing Steps:

  • Load MATLAB data:

    • Node attributes (sparse to dense)
    • Adjacency matrix
    • Group labels (one-hot to indices)
  • Convert to PyTorch format:

    • Edge indices from adjacency
    • Float features from attributes
    • Integer labels from groups
  • Create Data object with:

    • Edge indices
    • Node features
    • Node labels
    • Train/val/test masks
  • Apply pre-transform if specified

  • Save processed data

Data Split:

  • Training: 80%
  • Validation: 10%
  • Testing: 10%

Features:

  • Sparse to dense conversion
  • Type casting
  • Random split generation
  • Optional pre-transform support