topobench.data.loaders.graph.mantra_dataset module#
Loaders for Mantra dataset as graph.
- class AbstractLoader(parameters)#
Bases:
ABCAbstract class that provides an interface to load data.
- Parameters:
- parametersDictConfig
Configuration parameters.
- __init__(parameters)#
- get_data_dir()#
Get the data directory.
- Returns:
- Path
The path to the dataset directory.
- load(**kwargs)#
Load data.
- Parameters:
- **kwargsdict
Additional keyword arguments.
- Returns:
- tuple[torch_geometric.data.Data, str]
Tuple containing the loaded data and the data directory.
- abstract load_dataset()#
Load data into a dataset.
- Returns:
- Union[torch_geometric.data.Dataset, torch.utils.data.Dataset]
The loaded dataset, which could be a PyG or PyTorch dataset.
- Raises:
- NotImplementedError
If the method is not implemented.
- class DictConfig(content, key=None, parent=None, ref_type=typing.Any, key_type=typing.Any, element_type=typing.Any, is_optional=True, flags=None)#
Bases:
BaseContainer,MutableMapping[Any,Any]- __init__(content, key=None, parent=None, ref_type=typing.Any, key_type=typing.Any, element_type=typing.Any, is_optional=True, flags=None)#
- copy()#
- get(key, default_value=None)#
Return the value for key if key is in the dictionary, else default_value (defaulting to None).
- items() a set-like object providing a view on D's items#
- items_ex(resolve=True, keys=None)#
- keys() a set-like object providing a view on D's keys#
- pop(k[, d]) v, remove specified key and return the corresponding value.#
If key is not found, d is returned if given, otherwise KeyError is raised.
- setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D#
- class MantraDataset(root, name, parameters, **kwargs)#
Bases:
InMemoryDatasetDataset class for MANTRA manifold dataset.
- Parameters:
- rootstr
Root directory where the dataset will be saved.
- namestr
Name of the dataset.
- parametersDictConfig
Configuration parameters for the dataset.
- **kwargsdict
Additional keyword arguments.
- Attributes:
- URLS (dict): Dictionary containing the URLs for downloading the dataset.
- FILE_FORMAT (dict): Dictionary containing the file formats for the dataset.
- RAW_FILE_NAMES (dict): Dictionary containing the raw file names for the dataset.
- __init__(root, name, parameters, **kwargs)#
- download()#
Download the dataset from a URL and saves it to the raw directory.
- Raises:
FileNotFoundError – If the dataset URL is not found.
- process()#
Handle the data for the dataset.
This method loads the JSON file for MANTRA for the specified manifold dimmension, applies the respective preprocessing if specified and saves the preprocessed data to the appropriate location.
- URLS: ClassVar = {'2_manifolds': 'https://github.com/aidos-lab/mantra/releases/download/{version}/2_manifolds.json.gz', '3_manifolds': 'https://github.com/aidos-lab/mantra/releases/download/{version}/3_manifolds.json.gz'}#
- property processed_dir: str#
Return the path to the processed directory of the dataset.
- Returns:
- str
Path to the processed directory.
- property processed_file_names: str#
Return the processed file name for the dataset.
- Returns:
- str
Processed file name.
- property raw_dir: str#
Return the path to the raw directory of the dataset.
- Returns:
- str
Path to the raw directory.
- class MantraSimplicialDatasetLoader(parameters, **kwargs)#
Bases:
AbstractLoaderLoad Mantra dataset with configurable parameters.
Note: for the simplicial datasets it is necessary to include DatasetLoader into the name of the class!
- Parameters:
- parametersDictConfig
- Configuration parameters containing:
data_dir: Root directory for data
data_name: Name of the dataset
other relevant parameters
- **kwargsdict
Additional keyword arguments.
- __init__(parameters, **kwargs)#
- load_dataset(**kwargs)#
Load the Citation Hypergraph dataset.
- Parameters:
- **kwargsdict
Additional keyword arguments for dataset initialization.
- Returns:
- CitationHypergraphDataset
The loaded Citation Hypergraph dataset with the appropriate data_dir.
- Raises:
- RuntimeError
If dataset loading fails.