hoops_ai.dataset.graph_dataset
Functions
|
Example function to create a DGL graph from DatasetExplorer data. |
Classes
|
PyTorch Dataset class that uses a DatasetLoader object to dynamically create DGL graphs instead of loading pre-computed graphs from disk. |
|
DataLoader with background prefetching capability. |
- class hoops_ai.dataset.graph_dataset.GraphDataset(*args, **kwargs)
Bases:
DatasetPyTorch Dataset class that uses a DatasetLoader object to dynamically create DGL graphs instead of loading pre-computed graphs from disk. Integrates the collate function from GraphClassification flow model.
This dataset can either: 1. Create graphs on-the-fly from raw data stored in the DatasetExplorer 2. Fall back to loading pre-computed DGL graphs from disk if available
- Parameters:
- clear_cache()
Clear the in-memory cache.
- collate_function(batch)
Collate function for batching, similar to GraphClassification.collate_function.
- enable_cache(enable=True)
Enable or disable in-memory caching of loaded graphs.
- Parameters:
enable (bool) – Whether to enable caching
- get_dataloader(batch_size=32, shuffle=True, num_workers=0, drop_last=True, use_prefetch=True)
Create a DataLoader for this dataset.
- Parameters:
- Returns:
DataLoader instance
- Return type:
- class hoops_ai.dataset.graph_dataset.PrefetchDataLoader(*args, **kwargs)
Bases:
DataLoaderDataLoader with background prefetching capability.
- Parameters:
args (Any)
kwargs (Any)
- Return type:
Any
- hoops_ai.dataset.graph_dataset.create_graph_from_explorer(explorer, file_id_code)
Example function to create a DGL graph from DatasetExplorer data. This function demonstrates how to build a graph dynamically instead of loading from disk.
- Parameters:
explorer – DatasetExplorer instance
file_id_code (int) – File ID code to build graph for
- Returns:
DGL graph with node and edge features
- Return type:
dgl.DGLGraph