topobench.data.loaders package#

Subpackages#

Submodules#

topobench.data.loaders.base module#

Abstract Loader class.

class topobench.data.loaders.base.AbstractLoader(parameters: DictConfig)[source]#

Bases: ABC

Abstract class that provides an interface to load data.

Parameters:
parametersDictConfig

Configuration parameters.

get_data_dir() Path[source]#

Get the data directory.

Returns:
Path

The path to the dataset directory.

load(**kwargs) tuple[Data, str][source]#

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() Dataset | Dataset[source]#

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.

Module contents#

Init file for load module.

class topobench.data.loaders.AbstractLoader(parameters: DictConfig)[source]#

Bases: ABC

Abstract class that provides an interface to load data.

Parameters:
parametersDictConfig

Configuration parameters.

get_data_dir() Path[source]#

Get the data directory.

Returns:
Path

The path to the dataset directory.

load(**kwargs) tuple[Data, str][source]#

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() Dataset | Dataset[source]#

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 topobench.data.loaders.CitationHypergraphDatasetLoader(parameters: DictConfig)#

Bases: AbstractLoader

Load Citation Hypergraph dataset with configurable parameters.

Parameters:
parametersDictConfig
Configuration parameters containing:
  • data_dir: Root directory for data

  • data_name: Name of the dataset

  • other relevant parameters

load_dataset() CitationHypergraphDataset#

Load the Citation Hypergraph dataset.

Returns:
CitationHypergraphDataset

The loaded Citation Hypergraph dataset with the appropriate data_dir.

Raises:
RuntimeError

If dataset loading fails.

class topobench.data.loaders.GeometricShapesDatasetLoader(parameters: DictConfig)#

Bases: AbstractLoader

Load GeometricShapes dataset.

Parameters:
parametersDictConfig
Configuration parameters containing:
  • data_dir: Root directory for data

load_dataset() Dataset#

Load GeometricShapes dataset.

Returns:
Dataset

The loaded GeometricShapes dataset.

Raises:
RuntimeError

If dataset loading fails.

class topobench.data.loaders.HeterophilousGraphDatasetLoader(parameters: DictConfig)#

Bases: AbstractLoader

Load Heterophilous Graph datasets.

Parameters:
parametersDictConfig
Configuration parameters containing:
  • data_dir: Root directory for data

  • data_name: Name of the dataset

  • data_type: Type of the dataset (e.g., “heterophilous”)

load_dataset() Dataset#

Load Heterophilous Graph dataset.

Returns:
Dataset

The loaded Heterophilous Graph dataset.

Raises:
RuntimeError

If dataset loading fails.

class topobench.data.loaders.HypergraphDatasetLoader(parameters: DictConfig)#

Bases: AbstractLoader

Load Citation Hypergraph dataset with configurable parameters.

Parameters:
parametersDictConfig
Configuration parameters containing:
  • data_dir: Root directory for data

  • data_name: Name of the dataset

  • other relevant parameters

load_dataset() HypergraphDataset#

Load the Citation Hypergraph dataset.

Returns:
HypergraphDataset

The loaded Citation Hypergraph dataset with the appropriate data_dir.

Raises:
RuntimeError

If dataset loading fails.

class topobench.data.loaders.MantraSimplicialDatasetLoader(parameters: DictConfig, **kwargs)#

Bases: AbstractLoader

Load 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.

load_dataset(**kwargs) MantraDataset#

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.

class topobench.data.loaders.ManualGraphDatasetLoader(parameters: DictConfig)#

Bases: AbstractLoader

Load manually provided graph datasets.

Parameters:
parametersDictConfig
Configuration parameters containing:
  • data_name: Name of the dataset

  • data_dir: Root directory for data

get_data_dir() Path#

Get the data directory.

Returns:
Path

The path to the dataset directory.

load_dataset() Any#

Load the manual graph dataset.

Returns:
DataloadDataset

The dataset object containing the manually loaded graph.

class topobench.data.loaders.MoleculeDatasetLoader(parameters: DictConfig)#

Bases: AbstractLoader

Load molecule datasets (ZINC and AQSOL) with predefined splits.

Parameters:
parametersDictConfig
Configuration parameters containing:
  • data_dir: Root directory for data

  • data_name: Name of the dataset

  • data_type: Type of the dataset (e.g., “molecule”)

get_data_dir() Path#

Get the data directory.

Returns:
Path

The path to the dataset directory.

load_dataset() Dataset#

Load the molecule dataset with predefined splits.

Returns:
Dataset

The combined dataset with predefined splits.

Raises:
RuntimeError

If dataset loading fails.

class topobench.data.loaders.OGBGDatasetLoader(parameters: DictConfig)#

Bases: AbstractLoader

Load molecule datasets (molhiv, molpcba, ppa) with predefined splits.

Parameters:
parametersDictConfig
Configuration parameters containing:
  • data_dir: Root directory for data

  • data_name: Name of the dataset

  • data_type: Type of the dataset (e.g., “molecule”)

get_data_dir() Path#

Get the data directory.

Returns:
Path

The path to the dataset directory.

load_dataset() Dataset#

Load the molecule dataset with predefined splits.

Returns:
Dataset

The combined dataset with predefined splits.

Raises:
RuntimeError

If dataset loading fails.

class topobench.data.loaders.PlanetoidDatasetLoader(parameters: DictConfig)#

Bases: AbstractLoader

Load PLANETOID datasets.

Parameters:
parametersDictConfig
Configuration parameters containing:
  • data_dir: Root directory for data

  • data_name: Name of the dataset

  • data_type: Type of the dataset (e.g., “cocitation”)

load_dataset() Dataset#

Load Planetoid dataset.

Returns:
Dataset

The loaded Planetoid dataset.

Raises:
RuntimeError

If dataset loading fails.

class topobench.data.loaders.TUDatasetLoader(parameters: DictConfig)#

Bases: AbstractLoader

Load TU datasets.

Parameters:
parametersDictConfig
Configuration parameters containing:
  • data_dir: Root directory for data

  • data_name: Name of the dataset

  • data_type: Type of the dataset (e.g., “graph_classification”)

load_dataset() Dataset#

Load TU dataset.

Returns:
Dataset

The loaded TU dataset.

Raises:
RuntimeError

If dataset loading fails.

class topobench.data.loaders.USCountyDemosDatasetLoader(parameters: DictConfig)#

Bases: AbstractLoader

Load US County Demos dataset with configurable year and task variable.

Parameters:
parametersDictConfig
Configuration parameters containing:
  • data_dir: Root directory for data

  • data_name: Name of the dataset

  • year: Year of the dataset (if applicable)

  • task_variable: Task variable for the dataset

load_dataset() USCountyDemosDataset#

Load the US County Demos dataset.

Returns:
USCountyDemosDataset

The loaded US County Demos dataset with the appropriate data_dir.

Raises:
RuntimeError

If dataset loading fails.