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

Bases: InMemoryDataset

Facebook100 social network dataset loader for graph-based analysis.

Parameters:
  • root (str) –

    Root directory where the dataset should be saved

  • name (str) –

    Name of the Facebook dataset (must be one of the FB100 universities)

  • 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 Facebook users
  • Edges represent friendships
  • Node features from user metadata
  • Labels indicate user attributes
  • 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 and user metadata
download()

Download raw data files.

Notes

Empty implementation - data should be manually placed in raw directory

load_fb100(data_dir, filename, one_hot=True)

Load raw Facebook100 dataset file.

Parameters:
  • data_dir (str) –

    Path to the MATLAB file

  • filename (str) –

    Name of the dataset (must be one of the FB100 universities)

  • one_hot (bool, default: True ) –

    Whether to convert categorical features to one-hot encoding. Default: True

Returns:
  • tuple[Tensor, Tensor, Tensor]

    Contains:

    • x: Node feature matrix [num_nodes, num_features]
    • edge_index: Graph connectivity [2, num_edges]
    • y: Node labels [num_nodes]
Notes
  • Validates university name
  • Loads MATLAB file containing network structure
  • Processes metadata into features
  • Optionally converts features to one-hot encoding
  • Aggregates data from all universities for consistent encoding
process()

Process raw data into PyTorch Geometric Data format.

Notes

Processing Steps:

  • Load MATLAB data:

    • Network structure
    • User metadata
    • User attributes
  • Convert to PyTorch format:

    • Edge indices from adjacency
    • One-hot features from metadata
    • Integer labels from attributes
  • 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:

  • One-hot encoding
  • Metadata processing
  • Random split generation
  • Optional pre-transform support