Example code for linear optimal partial transport as introduced in the paper. The code repdocues the numerical examples in section 4 in the paper.
Install numba, pytorch, pythonOT before clone this repository.
Choose open set
where
- lib/lin_lopt.py contains a simple OPT solver based on LP in PythonOT, basic implementations for linearized OT and OPT embeddings, and a OT barycenter solver.
- lib/geodesic.py contains basic implementations for OT geodesic, LOT geodesic, OPT interporlation and LOPT interporlation.
- lib/HK contains the LHK implementations from Linear Hellinger Kantorovich.
- Run accuracy_test.ipynb to see the accuracy performance of LOPT distance.
- Run wall_clock_time.ipynb to see the wall clock test of OPT and LOPT.
- Run Interporlation.ipynb to see the comparison between OT geodesic, LOT geodesic, OPT interpolation, LOPT interporlations on MNIST data.
- Run pca.ipynb to see the comparison between LOT embeddings and LOPT embeddings