Giter Site home page Giter Site logo

borgwardtlab / topological-autoencoders Goto Github PK

View Code? Open in Web Editor NEW
128.0 7.0 32.0 51.7 MB

Code for the paper "Topological Autoencoders" by Michael Moor, Max Horn, Bastian Rieck, and Karsten Borgwardt.

License: BSD 3-Clause "New" or "Revised" License

Python 94.44% Makefile 1.15% Shell 4.41%
topological-data-analysis autoencoder tda persistent-homology

topological-autoencoders's Introduction

Topological Autoencoders

Reference

Please use the following BibTeX code to cite our paper, which is accepted for presentation at ICML 2020:

@InProceedings{Moor20Topological,
  author        = {Moor, Michael and Horn, Max and Rieck, Bastian and Borgwardt, Karsten},
  title         = {Topological Autoencoders},
  year          = {2020},
  eprint        = {1906.00722},
  archiveprefix = {arXiv},
  primaryclass  = {cs.LG},
  booktitle     = {Proceedings of the 37th International Conference on Machine Learning~(ICML)},
  series        = {Proceedings of Machine Learning Research},
  publisher     = {PMLR},
  volume        = {119},
  editor        = {Hal Daumé III and Aarti Singh},
  pages         = {7045--7054},
  abstract      = {We propose a novel approach for preserving topological structures of the input space in latent representations of autoencoders. Using persistent homology, a technique from topological data analysis, we calculate topological signatures of both the input and latent space to derive a topological loss term. Under weak theoretical assumptions, we construct this loss in a differentiable manner, such that the encoding learns to retain multi-scale connectivity information. We show that our approach is theoretically well-founded and that it exhibits favourable latent representations on a synthetic manifold as well as on real-world image data sets, while preserving low reconstruction errors.},
  pdf           = {http://proceedings.mlr.press/v119/moor20a/moor20a.pdf},
  url           = {http://proceedings.mlr.press/v119/moor20a.html},
}

Setup

In order to reproduce the results indicated in the paper simply setup an environment using the provided Pipfile and pipenv and run the experiments using the provided makefile:

pipenv install 

Alternatively, the exact versions used in this project can be accessed in requirements.txt, however this pip freeze contains a superset of all necessary libraries. To install it, run

pipenv install -r requirements.txt 

Running a method:

python -m exp.train_model -F test_runs with experiments/train_model/best_runs/Spheres/TopoRegEdgeSymmetric.json device='cuda'   

We used device='cuda', alternatively, if no gpu is available, use device='cpu'.

The above command trains our proposed method on the Spheres Data set and writes logging, results and visualizations to test_runs. For different methods or datasets simply adjust the last two directories of the path according to the directory structure. If the dataset is comparatively small, (e.g. Spheres), you may want to visualize the latent space on the larger training split as well. For this, simply append evaluation.save_training_latents=True at the end of the above command (position matters due to sacred).

Calling makefile

The makefile automatically executes all experiments in the experiments folder according to their highest level folder (e.g. experiments/train_model/xxx.json calls exp.train_model with the config file experiments/train_model/xxx.json) and writes the outputs to exp_runs/train_model/xxx/

For this use:

make filtered FILTER=train_model/repetitions

to run the test evaluations (repetitions) of the deep models and for remaining baselines:

make filtered FILTER=fit_competitor/repetitions

We created testing repetitions by using the config from the best runs of the hyperparameter search (stored in best_runs/)

The models found in train_model correspond to neural network architectures.

Using Aleph (optional)

In the paper, low-dimensional persistent homology calculations are implemented in Python directly. However, for higher dimensions, we recommend to use Aleph, a C++ library. We aim to better integrate this library into our code base, stay tuned!

Provided that all dependencies are satisfied, the following instructions should be sufficient to install the module:

$ git submodule update --init
$ cd Aleph
$ mkdir build
$ cd build
$ cmake ../
$ make aleph
$ cd ../../
$ pipenv run install_aleph

topological-autoencoders's People

Contributors

dependabot[bot] avatar expectationmax avatar mi92 avatar pseudomanifold avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

topological-autoencoders's Issues

Signature Computation function returns NoneType

Hello,

Regarding the implementation of SignatureComputation() in surrogate_based.py the forward() function doesn't return anything

class SignatureComputation(nn.Module):

This causes Line 66 to get NoneType value:

self.sig_comp = SignatureComputation(eps, dim)

leading to mismatch arguments at line 72 because the variable pers_x is NoneType.
Request you to please sort this out.

-Prashant

python version

When configuring the environment, which version of Python is used?

Matching of distances between latent and data space

We are not yet correctly matching distances in the latent space with distances in the data space.

Should we do that?

If so:

  • should be handled in the signature computation by sorting the vector according to the construction enge

multicoretsne

Good morning,sir:
I am a Chinese student.I'm reading your article recently and I'm very interested in your research. But there is something wrong with the use of code.I can't install multicoretsne.The below is the information.

Installing dependencies from Pipfile...

================================ 1/1 - 00:00:00
An error occurred while installing multicoretsne==0.1! Will try again.
Installing initially failed dependencies...
[InstallError]: File "d:\anaconda3\lib\site-packages\pipenv\cli\command.py", line 253, in install
[InstallError]: site_packages=state.site_packages
[InstallError]: File "d:\anaconda3\lib\site-packages\pipenv\core.py", line 2063, in do_install
[InstallError]: keep_outdated=keep_outdated
[InstallError]: File "d:\anaconda3\lib\site-packages\pipenv\core.py", line 1312, in do_init
[InstallError]: pypi_mirror=pypi_mirror,
[InstallError]: File "d:\anaconda3\lib\site-packages\pipenv\core.py", line 900, in do_install_dependencies
[InstallError]: retry_list, procs, failed_deps_queue, requirements_dir, **install_kwargs
[InstallError]: File "d:\anaconda3\lib\site-packages\pipenv\core.py", line 796, in batch_install
[InstallError]: _cleanup_procs(procs, failed_deps_queue, retry=retry)
[InstallError]: File "d:\anaconda3\lib\site-packages\pipenv\core.py", line 703, in _cleanup_procs
[InstallError]: raise exceptions.InstallError(c.dep.name, extra=err_lines)
[pipenv.exceptions.InstallError]: Collecting multicoretsne==0.1
[pipenv.exceptions.InstallError]: Using cached MulticoreTSNE-0.1.tar.gz (20 kB)
[pipenv.exceptions.InstallError]: Requirement already satisfied: numpy in c:\users\11.virtualenvs\topological-autoencoders->

master-0ayfqafo\lib\site-packages (from multicoretsne==0.1->-r c:\users\11\appdata\local\temp\pipenv-690j2s7

0-requirements\pipenv-7rw5i6kr-requirement.txt (line 1)) (1.20.3)

[pipenv.exceptions.InstallError]: Requirement already satisfied: cffi in c:\users\11.virtualenvs\topological-autoencoders-master-0ayfqafo\lib\site-packages (from multicoretsne==0.1->-r c:\users\11\appdata\local\temp\pipenv-690j2s70

-requirements\pipenv-7rw5i6kr-requirement.txt (line 1)) (1.14.5)

[pipenv.exceptions.InstallError]: Requirement already satisfied: pycparser in c:\users\11.virtualenvs\topological-autoencoders-master-0ayfqafo\lib\site-packages (from cffi->multicoretsne==0.1->-r c:\users\11\appdata\local\temp\pipe
nv-690j2s70-requirements\pipenv-7rw5i6kr-requirement.txt (line 1)) (2.20)
[pipenv.exceptions.InstallError]:** Building wheels for collected packages: multicoretsne
[pipenv.exceptions.InstallError]: Building wheel for multicoretsne (setup.py): started
[pipenv.exceptions.InstallError]: Building wheel for multicoretsne (setup.py): finished with status 'error'
[pipenv.exceptions.InstallError]: ERROR: Command errored out with exit status 1:
[pipenv.exceptions.InstallError]: command: 'C:\Users\11.virtualenvs\topological-autoencoders-master-0aYfqAfO\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\11\AppData\Local\
Temp\pip-install-ynrf4fmk\multicoretsne_89da54d44b404fda91ecb877e4c62a16\setup.py'"'"'; file='"'"'C:\Users\11\AppData\Local\Temp\pip-install-ynrf4fmk\multicoretsne_89da54d44b404fda91ecb877e4c62a16\setup.py'"'"';f = ge
tattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file
, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\11\AppData\Local\Temp\pip-wheel-h6snep7e'
[pipenv.exceptions.InstallError]: cwd: C:\Users\11\AppData\Local\Temp\pip-install-ynrf4fmk\multicoretsne_89da54d44b404fda91ecb877e4c62a16
[pipenv.exceptions.InstallError]: Complete output (29 lines):
[pipenv.exceptions.InstallError]: running bdist_wheel
[pipenv.exceptions.InstallError]: running build
[pipenv.exceptions.InstallError]: running build_py
[pipenv.exceptions.InstallError]: creating build
[pipenv.exceptions.InstallError]: creating build\lib.win-amd64-3.7
[pipenv.exceptions.InstallError]: creating build\lib.win-amd64-3.7\MulticoreTSNE
[pipenv.exceptions.InstallError]: copying MulticoreTSNE_init
.py -> build\lib.win-amd64-3.7\MulticoreTSNE
[pipenv.exceptions.InstallError]: creating build\lib.win-amd64-3.7\MulticoreTSNE\tests
[pipenv.exceptions.InstallError]: copying MulticoreTSNE\tests\test_base.py -> build\lib.win-amd64-3.7\MulticoreTSNE\tests
[pipenv.exceptions.InstallError]: copying MulticoreTSNE\tests_init
.py -> build\lib.win-amd64-3.7\MulticoreTSNE\tests
[pipenv.exceptions.InstallError]: running egg_info
[pipenv.exceptions.InstallError]: writing MulticoreTSNE.egg-info\PKG-INFO
[pipenv.exceptions.InstallError]: writing dependency_links to MulticoreTSNE.egg-info\dependency_links.txt
[pipenv.exceptions.InstallError]: writing requirements to MulticoreTSNE.egg-info\requires.txt
[pipenv.exceptions.InstallError]: writing top-level names to MulticoreTSNE.egg-info\top_level.txt
[pipenv.exceptions.InstallError]: reading manifest file 'MulticoreTSNE.egg-info\SOURCES.txt'
[pipenv.exceptions.InstallError]: reading manifest template 'MANIFEST.in'
[pipenv.exceptions.InstallError]: adding license file 'LICENSE.txt'
[pipenv.exceptions.InstallError]: writing manifest file 'MulticoreTSNE.egg-info\SOURCES.txt'
[pipenv.exceptions.InstallError]: warning: build_py: byte-compiling is disabled, skipping.
[pipenv.exceptions.InstallError]:
[pipenv.exceptions.InstallError]: running build_ext
[pipenv.exceptions.InstallError]: cmake version 3.20.3
[pipenv.exceptions.InstallError]:
[pipenv.exceptions.InstallError]: CMake suite maintained and supported by Kitware (kitware.com/cmake).
[pipenv.exceptions.InstallError]: CMake Error: Unknown argument --
[pipenv.exceptions.InstallError]: CMake Error: Run 'cmake --help' for all supported options.
[pipenv.exceptions.InstallError]:
[pipenv.exceptions.InstallError]: ERROR: Cannot generate Makefile. See above errors.
[pipenv.exceptions.InstallError]: ----------------------------------------
[pipenv.exceptions.InstallError]: ERROR: Failed building wheel for multicoretsne
[pipenv.exceptions.InstallError]: Running setup.py clean for multicoretsne
[pipenv.exceptions.InstallError]: Failed to build multicoretsne
[pipenv.exceptions.InstallError]: Installing collected packages: multicoretsne
[pipenv.exceptions.InstallError]: Running setup.py install for multicoretsne: started
[pipenv.exceptions.InstallError]: Running setup.py install for multicoretsne: finished with status 'error'
[pipenv.exceptions.InstallError]: ERROR: Command errored out with exit status 1:
[pipenv.exceptions.InstallError]: command: 'C:\Users\11.virtualenvs\topological-autoencoders-master-0aYfqAfO\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\11\AppData\Local
\Temp\pip-install-ynrf4fmk\multicoretsne_89da54d44b404fda91ecb877e4c62a16\setup.py'"'"'; file='"'"'C:\Users\11\AppData\Local\Temp\pip-install-ynrf4fmk\multicoretsne_89da54d44b404fda91ecb877e4c62a16\setup.py'"'"';f =
getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, fil
e
, '"'"'exec'"'"'))' install --record 'C:\Users\11\AppData\Local\Temp\pip-record-8yv_r9yl\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\11.virtualenvs\topological-autoencoders-maste
r-0aYfqAfO\include\site\python3.7\multicoretsne'
[pipenv.exceptions.InstallError]: cwd: C:\Users\11\AppData\Local\Temp\pip-install-ynrf4fmk\multicoretsne_89da54d44b404fda91ecb877e4c62a16
[pipenv.exceptions.InstallError]: Complete output (29 lines):
[pipenv.exceptions.InstallError]: running install
[pipenv.exceptions.InstallError]: running build
[pipenv.exceptions.InstallError]: running build_py
[pipenv.exceptions.InstallError]: creating build
[pipenv.exceptions.InstallError]: creating build\lib.win-amd64-3.7
[pipenv.exceptions.InstallError]: creating build\lib.win-amd64-3.7\MulticoreTSNE
[pipenv.exceptions.InstallError]: copying MulticoreTSNE_init_.py -> build\lib.win-amd64-3.7\MulticoreTSNE
[pipenv.exceptions.InstallError]: creating build\lib.win-amd64-3.7\MulticoreTSNE\tests
[pipenv.exceptions.InstallError]: copying MulticoreTSNE\tests\test_base.py -> build\lib.win-amd64-3.7\MulticoreTSNE\tests
[pipenv.exceptions.InstallError]: copying MulticoreTSNE\tests_init_.py -> build\lib.win-amd64-3.7\MulticoreTSNE\tests
[pipenv.exceptions.InstallError]: running egg_info
[pipenv.exceptions.InstallError]: writing MulticoreTSNE.egg-info\PKG-INFO
[pipenv.exceptions.InstallError]: writing dependency_links to MulticoreTSNE.egg-info\dependency_links.txt
[pipenv.exceptions.InstallError]: writing requirements to MulticoreTSNE.egg-info\requires.txt
[pipenv.exceptions.InstallError]: writing top-level names to MulticoreTSNE.egg-info\top_level.txt
[pipenv.exceptions.InstallError]: reading manifest file 'MulticoreTSNE.egg-info\SOURCES.txt'
[pipenv.exceptions.InstallError]: reading manifest template 'MANIFEST.in'
[pipenv.exceptions.InstallError]: adding license file 'LICENSE.txt'
[pipenv.exceptions.InstallError]: writing manifest file 'MulticoreTSNE.egg-info\SOURCES.txt'
[pipenv.exceptions.InstallError]: warning: build_py: byte-compiling is disabled, skipping.
[pipenv.exceptions.InstallError]:
[pipenv.exceptions.InstallError]: running build_ext
[pipenv.exceptions.InstallError]: cmake version 3.20.3
[pipenv.exceptions.InstallError]:
[pipenv.exceptions.InstallError]: CMake suite maintained and supported by Kitware (kitware.com/cmake).
[pipenv.exceptions.InstallError]: CMake Error: Unknown argument --
[pipenv.exceptions.InstallError]: CMake Error: Run 'cmake --help' for all supported options.
[pipenv.exceptions.InstallError]:
[pipenv.exceptions.InstallError]: ERROR: Cannot generate Makefile. See above errors.
[pipenv.exceptions.InstallError]: ----------------------------------------
[pipenv.exceptions.InstallError]: ERROR: Command errored out with exit status 1: 'C:\Users\11.virtualenvs\topological-autoencoders-master-0aYfqAfO\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '
"'"'C:\Users\11\AppData\Local\Temp\pip-install-ynrf4fmk\multicoretsne_89da54d44b404fda91ecb877e4c62a16\setup.py'"'"'; file='"'"'C:\Users\11\AppData\Local\Temp\pip-install-ynrf4fmk\multicoretsne_89da54d44b404fda91e
cb877e4c62a16\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f
.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\11\AppData\Local\Temp\pip-record-8yv_r9yl\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\11.virtualen
vs\topological-autoencoders-master-0aYfqAfO\include\site\python3.7\multicoretsne' Check the logs for full command output.
ERROR: Couldn't install package: multicoretsne
Package installation failed...
================================ 0/1 - 00:00:03`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.