This repository provides a reproducibility-focused implementation for anisotropic topological denoising experiments.
For data layout, checkpoints, figure-related scripts, and CI tests, see REPRODUCIBILITY.md (reader-facing).
Use uv as the canonical dependency manager.
torch_topological is a local path dependency (pyproject.toml → pytorch-topological/). That directory is not always present after a plain git clone; sync it to the pinned commit in third_party/pytorch_topological.ref (same as CI):
./scripts/ensure_pytorch_topological.shOptional: if this repository records pytorch-topological as a git submodule gitlink, git submodule update --init --recursive may populate the tree first; the ensure script still verifies the pinned commit. See third_party/README.md when bumping the pin.
Then install Python dependencies:
uv syncFor development dependencies:
uv sync --all-groupsOptional package extras (e.g. robustness_sweep, HomCloud animation, explicit Pillow):
uv sync --extra experiments --extra repro-pd-animation --extra imagesIf you use pip instead of uv, run ./scripts/ensure_pytorch_topological.sh from the repository root, then install from pyproject.toml with pip install . or pip install -e . for an editable install; add optional extras when needed (for example pip install -e ".[experiments,repro-pd-animation,images]"). There is no requirements.txt; dependency pins live in uv.lock for uv users.
Use the following command as the official reproduction entrypoint:
uv run python experiments/run_backend_multiseed.py \
--base-config reproduce \
--epochs 50 \
--seeds 42 123 456 789 1024 \
--backends mahalanobis ellphi \
--out-base outputs/backend_compareRun this command from the repository root.
Expected artifacts:
outputs/backend_compare/progress_summary.csvoutputs/backend_compare/backend_stats.csvoutputs/backend_compare/*/logs/metrics.csv
Direct execution of tda_ml/main.py is non-official and not part of the canonical reproduction path.
run_backend_multiseed.pyskips completed runs using the key(backend, seed, epochs).- Changing
--epochscreates a different run key and will not be skipped. - Use
--rerun-completedto force rerun even when the same key already exists. progress_summary.csvheader is validated on startup. If header mismatch occurs, use a fresh--out-baseor fix the CSV manually.
run_backend_multiseed.pycreates a lock file under--out-baseand aborts if another process is active there.progress_summary.csvstoresrun_diras provided by--out-base; avoid sharing logs with personal absolute paths if privacy is a concern.- Keep
metrics.csvschema compatible with the current trainer output (val_mcc,val_recall,val_lossare required).
For a fast wiring check before the full run:
uv run python experiments/run_backend_multiseed.py \
--base-config reproduce \
--epochs 1 \
--seeds 42 \
--backends mahalanobis \
--out-base outputs/smokeOn pull requests and pushes to main / feature/**, CI runs:
ruff checkpytest- A repro smoke only:
run_backend_multiseed.pywith--epochs 1, one seed, andmahalanobis(see.github/workflows/ruff.yml).
The full official command (50 epochs × five seeds × two backends) is not executed in CI. Run that locally or in your own runner when validating paper numbers.
- The official comparison uses a fixed five-seed set:
42 123 456 789 1024. - Runtime and numeric behavior can vary by
device,thread, anddtype; effective values should be logged per run. - External implementations are reference-only and are not redistributed in this repository.
- Scripts under
tda_ml/experiments/are non-official and require your own checkpoints (seeconfigs/README.md). run_backend_multiseed.pymultiseed backend comparison is not a pure distance-backend-only ablation; it compares full training pipelines, not an isolated backend switch.- For topological loss,
mahalanobiscan incorporate predicted outlier-probability weighting in the distance matrix;ellphidoes not (geometry-only distances;probsignored). - Read outcomes as two full pipelines under the same schedule and config surface, not as isolating distance-backend effects alone.
For topological loss, the batched distance matrix is built per model.topology_loss.distance_backend. With mahalanobis, the implementation can incorporate predicted outlier probabilities when forming pairwise distances (see tda_ml.topology.compute_anisotropic_distance_matrix). With ellphi, tangency distances are computed from ellipse geometry only; probability-based weighting is not implemented and probs are ignored (a warning is emitted once per process; see tda_ml.distance_backend.compute_distance_matrix_batch). Hyperparameters in configs/reproduce.yaml are shared across backends, but the induced metric for topological loss is not identical across backends by design: the intended read is a reproducible pipeline comparison (same data, schedule, and config surface), not a claim that both backends optimize the exact same weighted distance objective. Elliptic contact distances are left as defined by ellphi; no synthetic “prob-equivalent” weighting is applied on the ellphi path.
This project is licensed under the MIT License. See LICENSE.
External implementations (for example ellphi_repo and pytorch-topological) are reference-only and are not redistributed here.
https://github.com/t-uda/ellphihttps://github.com/aidos-lab/pytorch-topological