Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions configs/dataset/hypergraph/miplib.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Dataset loader config
loader:
_target_: topobench.data.loaders.MIPLIBDatasetLoader
parameters:
data_domain: hypergraph
data_type: miplib
data_name: benchmark
data_dir: ${paths.data_dir}/${dataset.loader.parameters.data_domain}/${dataset.loader.parameters.data_type}
task_level: graph

# Dataset parameters
parameters:
num_features: 7 # 3 numerical + 4 one-hot encoded variable type features
num_classes: 1 # Regression output (continuous value per variable)
task: regression
loss_type: mse # Mean Squared Error for regression
monitor_metric: mae # Mean Absolute Error
task_level: graph # Predicting objective value for the graph

#splits
split_params:
learning_setting: inductive
data_split_dir: ${paths.data_dir}/data_splits/${dataset.loader.parameters.data_name}
data_seed: 0
split_type: random
k: 10
train_prop: 0.5

# Dataloader parameters
dataloader_params:
batch_size: 1
num_workers: 1
pin_memory: False
112 changes: 51 additions & 61 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ build-backend = "setuptools.build_meta"
name = "TopoBench"
dynamic = ["version"]
authors = [
{name = "Topological Intelligence Team Authors", email = "tlscabinet@gmail.com"}
{ name = "Topological Intelligence Team Authors", email = "tlscabinet@gmail.com" },
]
readme = "README.md"
description = "Topological Deep Learning"
license = {file = "LICENSE.txt"}
license = { file = "LICENSE.txt" }
classifiers = [
"License :: OSI Approved :: MIT License",
"Development Status :: 4 - Beta",
Expand All @@ -21,10 +21,10 @@ classifiers = [
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11"
"Programming Language :: Python :: 3.11",
]
requires-python = ">= 3.10"
dependencies=[
requires-python = "==3.11.3"
dependencies = [
"tqdm",
"charset-normalizer",
"numpy",
Expand Down Expand Up @@ -54,8 +54,16 @@ dependencies=[
"topomodelx @ git+https://github.com/pyt-team/TopoModelX.git",
"toponetx @ git+https://github.com/pyt-team/TopoNetX.git",
"lightning==2.4.0",

# MIP branch dependencies
"datasets>=4.4.1",
"pyscipopt>=5.7.1",
]

[dependency-groups]
dev = ["ipykernel>=6.30.0", "nbformat>=5.10.4"]


[project.optional-dependencies]
doc = [
"jupyter",
Expand All @@ -65,30 +73,20 @@ doc = [
"sphinx",
"sphinx_gallery",
"pydata-sphinx-theme",
"myst_parser"
]
lint = [
"pre-commit",
"ruff"
]
test = [
"pytest",
"pytest-cov",
"coverage",
"jupyter",
"mypy",
"pytest-mock"
"myst_parser",
]
lint = ["pre-commit", "ruff"]
test = ["pytest", "pytest-cov", "coverage", "jupyter", "mypy", "pytest-mock"]

dev = ["TopoBench[test, lint]"]
all = ["TopoBench[dev, doc]"]

[project.urls]
homepage="https://geometric-intelligence.github.io/topobench/index.html"
repository="https://github.com/geometric-intelligence/TopoBench"
homepage = "https://geometric-intelligence.github.io/topobench/index.html"
repository = "https://github.com/geometric-intelligence/TopoBench"

[tool.black]
line-length = 79 # PEP 8 standard for maximum line length
line-length = 79 # PEP 8 standard for maximum line length
target-version = ['py310']

[tool.docformatter]
Expand All @@ -99,35 +97,35 @@ wrap-descriptions = 79
target-version = "py310"
#extend-include = ["*.ipynb"]
extend-exclude = ["test", "tutorials", "notebooks"]
line-length = 79 # PEP 8 standard for maximum line length
line-length = 79 # PEP 8 standard for maximum line length

[tool.ruff.format]
docstring-code-format = false

[tool.ruff.lint]
select = [
"F", # pyflakes errors
"E", # code style
"W", # warnings
"I", # import order
"UP", # pyupgrade rules
"B", # bugbear rules
"PIE", # pie rules
"Q", # quote rules
"RET", # return rules
"SIM", # code simplifications
"NPY", # numpy rules
"F", # pyflakes errors
"E", # code style
"W", # warnings
"I", # import order
"UP", # pyupgrade rules
"B", # bugbear rules
"PIE", # pie rules
"Q", # quote rules
"RET", # return rules
"SIM", # code simplifications
"NPY", # numpy rules
"PERF", # performance rules
]
fixable = ["ALL"]
ignore = [
"E501", # line too long
"RET504", # Unnecessary assignment before return
"RET505", # Unnecessary `elif` after `return` statement
"NPY002", # Replace legacy `np.random.seed` call with `np.random.Generator`
"UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)` -- not compatible with python 3.9 (even with __future__ import)
"W293", # Does not allow to have empty lines in multiline comments
"PERF203", # [TODO: fix all such issues] `try`-`except` within a loop incurs performance overhead
"E501", # line too long
"RET504", # Unnecessary assignment before return
"RET505", # Unnecessary `elif` after `return` statement
"NPY002", # Replace legacy `np.random.seed` call with `np.random.Generator`
"UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)` -- not compatible with python 3.9 (even with __future__ import)
"W293", # Does not allow to have empty lines in multiline comments
"PERF203", # [TODO: fix all such issues] `try`-`except` within a loop incurs performance overhead
]

[tool.ruff.lint.pydocstyle]
Expand All @@ -138,13 +136,10 @@ convention = "numpy"
"tests/*" = ["D"]

[tool.setuptools.dynamic]
version = {attr = "topobench.__version__"}
version = { attr = "topobench.__version__" }

[tool.setuptools.packages.find]
include = [
"topobench",
"topobench.*"
]
include = ["topobench", "topobench.*"]

[tool.mypy]
warn_redundant_casts = true
Expand All @@ -155,26 +150,21 @@ plugins = "numpy.typing.mypy_plugin"

[[tool.mypy.overrides]]
module = [
"torch_cluster.*","networkx.*","scipy.spatial","scipy.sparse","toponetx.classes.simplicial_complex"
"torch_cluster.*",
"networkx.*",
"scipy.spatial",
"scipy.sparse",
"toponetx.classes.simplicial_complex",
]
ignore_missing_imports = true

[tool.pytest.ini_options]
addopts = "--capture=no"
pythonpath = [
"."
]
pythonpath = ["."]

[tool.numpydoc_validation]
checks = [
"all",
"GL01",
"ES01",
"EX01",
"SA01"
]
exclude = [
'\.undocumented_method$',
'\.__init__$',
'\.__repr__$',
]
checks = ["all", "GL01", "ES01", "EX01", "SA01"]
exclude = ['\.undocumented_method$', '\.__init__$', '\.__repr__$']

[tool.uv]
find-links = ["https://data.pyg.org/whl/torch-2.3.0+cpu.html"]
8 changes: 7 additions & 1 deletion test/_utils/simplified_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@ def run(cfg: DictConfig) -> DictConfig:
"""
# Instantiate and load dataset
dataset_loader = hydra.utils.instantiate(cfg.dataset.loader)
dataset, dataset_dir = dataset_loader.load()

# Check for slice in dataset config
load_kwargs = {}
if "slice" in cfg.dataset:
load_kwargs["slice"] = cfg.dataset.slice

dataset, dataset_dir = dataset_loader.load(**load_kwargs)
# Preprocess dataset and load the splits
transform_config = cfg.get("transforms", None)
preprocessor = PreProcessor(dataset, dataset_dir, transform_config)
Expand Down
5 changes: 3 additions & 2 deletions test/data/load/test_datasetloaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def _gather_config_files(self, base_dir: Path) -> List[str]:
# Below the datasets that have some default transforms with we manually overriten with no_transform,
# due to lack of default transform for domain2domain
"REDDIT-BINARY.yaml", "IMDB-MULTI.yaml", "IMDB-BINARY.yaml", #"ZINC.yaml"
"ogbg-molpcba.yaml", "manual_dataset.yaml" # "ogbg-molhiv.yaml"
"ogbg-molpcba.yaml", "manual_dataset.yaml", # "ogbg-molhiv.yaml"
"miplib.yaml"
}

# Below the datasets that takes quite some time to load and process
Expand Down Expand Up @@ -87,7 +88,7 @@ def _load_dataset(self, data_domain: str, config_file: str) -> Tuple[Any, Dict]:
print(repr(dataset_loader))

if config_file in self.long_running_datasets:
dataset, data_dir = dataset_loader.load(slice=100)
dataset, data_dir = dataset_loader.load(slice=10)
else:
dataset, data_dir = dataset_loader.load()
return dataset, data_dir
Expand Down
6 changes: 4 additions & 2 deletions test/pipeline/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
from test._utils.simplified_pipeline import run


DATASET = "graph/MUTAG" # ADD YOUR DATASET HERE
MODELS = ["graph/gcn", "cell/topotune", "simplicial/topotune"] # ADD ONE OR SEVERAL MODELS OF YOUR CHOICE HERE

DATASET = "hypergraph/miplib"
MODELS = ["hypergraph/edgnn"]


class TestPipeline:
Expand All @@ -29,6 +30,7 @@ def test_pipeline(self):
"trainer.check_val_every_n_epoch=1",
"paths=test",
"callbacks=model_checkpoint",
"+dataset.slice=30"
],
return_hydra_config=True
)
Expand Down
Loading
Loading