This repository contains the code for the paper:
Skrodzki, M., van Geffen, H., Chaves-de-Plaza, N.F., Höllt, T., Eisemann, E. and Hildebrandt, K., "Accelerating hyperbolic t-SNE", 2024, IEEE TCVG (DOI: 10.1109/TVCG.2024.3364841).
If you use our code in your publications please consider citing:
@article{skrodzki2024hyperbolic,
title={Accelerating hyperbolic t-SNE},
author={Skrodzki, Martin and van Geffen, Hunter and Chaves-de-Plaza, Nicolas F. and H\"{o}llt, Thomas and Eisemann, Elmar and Hildebrandt, Klaus},
journal={IEEE Transactions on Visualization and Computer Graphics},
year={2024},
volume={30},
number={7},
pages={4403--4415},
doi={10.1109/TVCG.2024.3364841},
eprint={[TODO](https://ieeexplore.ieee.org/document/10432970)}
}
Please find the published version of the paper here.
You can set up the repository by building the provided Docker file calling docker build --tag 'hyperbolic-tsne' .
in the folder where you cloned the repository. Alternatively, you can perform the following steps yourself:
- Install conda (we recommend using miniconda)
- Create environment:
conda create --name=htsne python=3.9.16
- Activate environment:
conda activate htsne
- Install dependencies with pip:
pip install -r requirements.txt
- Build Cython extensions:
python setup.py build_ext --inplace
- Install hyperbolic-tsne package:
pip install .
- To test installation run
python -c "from hyperbolicTSNE import HyperbolicTSNE"
. No errors should be raised and you should see the outputPlease note that 'empty_sequence' uses the KL divergence with Barnes-Hut approximation (angle=0.5) by default.
. - To re-create the teaser image of this repository, run
python experiments_and_plots/plot_tree_teaser.py
which will read the embedding data and labels from theteaser_files
folder, plot the teaser image, and save it to theteaser_files
folder.
Note 1: On macOS, the build process of the Cython extensions might yield an error if it cannot find OpenMP. This error can be ignored and the package will still be correctly installed and able to run. The main consequence of this error is that the optimization iterations run slower.
Note 2: When replicating the teaser image of the repository, depending on your random choice, the image you create might highlight a different point in the left embedding than what is shown in the teaser. We encourage you to change the seed and render several such images. The right-hand side will always show the same embedding, but the left-hand side will give you the query structure of the tree for different vertices. Thereby, you can see which regions are approximated (showing larger cells of the polar quadtree) and which are drilling down to the individual points (showing smaller cells of the polar quadtree).
You can run hyperbolic TSNE on your high-dimensional data.
Nevertheless, the examples and experiments in this repository rely on specific datasets.
Below, we provide download links for each.
We recommend putting all datasets in a datasets
directory at the root of this repository.
The load_data
function expects this path (data_home
) to resolve the dataset.
Individual instructions per dataset:
There are two ways of getting started with the hyperbolicTSNE
package.
First, example_basic_usage.ipynb
offers a step-by-step guide showing how to use the HyperbolicTSNE package to embed a high-dimensional dataset.
Second, the example_different_params.py
script shows how to set up a script for quick experimentation. In this case, to compare the effect of different parameters.
This folder contains three types of files:
- Scripts to generate experimental data via embedding different data sets into hyperbolic space. These are pre-fixed with "data generation".
- Scripts to create plots from the data, as they appear in the publication.
- Scripts to create tables from the data, as they appear in the publication.
The general workflow to reproduce the results from the paper is:
- Run the scripts to generate data.
- Run the scripts to plot the data.
- Run the scripts to generate tables.
Note that the data generation scripts assume a top-level folder, i.e., a folder next to "examples", "experiments", etc., called "datasets" that holds the datasets to be embedded.
The source code in this repository is released under the MIT License. However, all used third-party software libraries are governed by their respective licenses. Without the following libraries, this project would have been considerably harder: scipy, numpy, scikit-learn, hnswlib, pandas, anndata, seaborn, setuptools, Cython, tqdm, ipykernel.