TwitchDataset(root, name, transform=None, pre_transform=None, pre_filter=None)
Bases: InMemoryDataset
Twitch social network dataset loader for graph-based analysis.
| Parameters: |
|
|---|
Notes
Dataset Structure:
- Nodes represent Twitch users
- Edges represent user connections
- Node features from user activities
- Labels indicate user attributes
- Includes train/val/test splits (80/10/10)
processed_file_names
property
Names of processed data files.
| Returns: |
|
|---|
Notes
Processed files:
- data.pt: Contains processed PyTorch Geometric data object
raw_file_names
property
Names of required raw files.
| Returns: |
|
|---|
Notes
Required files:
- edges.csv: Network connectivity data
- features.json: User feature data
- target.csv: User labels
download()
Download raw data files.
Notes
Empty implementation - data should be manually placed in raw directory
load_dataset(lang)
Load raw Twitch dataset files.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Notes
Processing Steps:
-
Load target data:
- Handle non-unique rows
- Extract binary labels
- Map node IDs
-
Load edge data:
- Create adjacency matrix
- Handle sparse connections
-
Load feature data:
- Parse JSON features
- Create sparse feature matrix
-
Reorder nodes:
- Ensure consistent indexing
- Map node IDs to indices
process()
Process raw data into PyTorch Geometric Data format.
Notes
Processing Steps:
-
Load dataset files:
- Adjacency matrix
- Node labels
- Feature matrix
-
Convert to PyTorch format:
- Edge indices from sparse adjacency
- Float features from sparse matrix
- Integer labels from binary values
-
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 matrix handling
- JSON feature processing
- Random split generation
- Optional pre-transform support