Skip to main content

Extensible, parallel implementations of t-SNE

Project description

Build Status Documentation Status License Badge

openTSNE is a modular Python implementation of t-Distributed Stochasitc Neighbor Embedding (t-SNE) [1], a popular dimensionality-reduction algorithm for visualizing high-dimensional data sets. openTSNE incorporates the latest improvements to the t-SNE algorithm, including the ability to add new data points to existing embeddings [2], massive speed improvements [3] [4] [5], enabling t-SNE to scale to millions of data points and various tricks to improve global alignment of the resulting visualizations [6].

Macosko 2015 mouse retina t-SNE embedding

A visualization of 44,808 single cell transcriptomes obtained from the mouse retina [7] embedded using the multiscale kernel trick to better preserve the global aligment of the clusters.

Installation

openTSNE requires Python 3.8 or higher in order to run.

Conda

openTSNE can be easily installed from conda-forge with

conda install --channel conda-forge opentsne

Conda package

PyPi

openTSNE is also available through pip and can be installed with

pip install opentsne

PyPi package

Installing from source

If you wish to install openTSNE from source, please run

pip install .

in the root directory to install the appropriate dependencies and compile the necessary binary files.

Please note that openTSNE requires a C/C++ compiler to be available on the system.

In order for openTSNE to utilize multiple threads, the C/C++ compiler must support OpenMP. In practice, almost all compilers implement this with the exception of older version of clang on OSX systems.

To squeeze the most out of openTSNE, you may also consider installing FFTW3 prior to installation. FFTW3 implements the Fast Fourier Transform, which is heavily used in openTSNE. If FFTW3 is not available, openTSNE will use numpy’s implementation of the FFT, which is slightly slower than FFTW. The difference is only noticeable with large data sets containing millions of data points.

A hello world example

Getting started with openTSNE is very simple. First, we’ll load up some data using scikit-learn

from sklearn import datasets

iris = datasets.load_iris()
x, y = iris["data"], iris["target"]

then, we’ll import and run

from openTSNE import TSNE

embedding = TSNE().fit(x)

Citation

If you make use of openTSNE for your work we would appreciate it if you would cite the paper

@article{Policar2024,
    title={openTSNE: A Modular Python Library for t-SNE Dimensionality Reduction and Embedding},
    author={Poli{\v c}ar, Pavlin G. and Stra{\v z}ar, Martin and Zupan, Bla{\v z}},
    journal={Journal of Statistical Software},
    year={2024},
    volume={109},
    number={3},
    pages={1–30},
    doi={10.18637/jss.v109.i03},
    url={https://www.jstatsoft.org/index.php/jss/article/view/v109i03}
}

openTSNE implements two efficient algorithms for t-SNE. Please consider citing the original authors of the algorithm that you use. If you use FIt-SNE (default), then the citation is [5] below, but if you use Barnes-Hut the citations are [3] and [4].

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opentsne-1.0.2.tar.gz (251.2 kB view hashes)

Uploaded Source

Built Distributions

openTSNE-1.0.2-cp312-cp312-win_amd64.whl (469.3 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

openTSNE-1.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.2 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

openTSNE-1.0.2-cp312-cp312-macosx_10_12_universal2.whl (1.0 MB view hashes)

Uploaded CPython 3.12 macOS 10.12+ universal2 (ARM64, x86-64)

openTSNE-1.0.2-cp311-cp311-win_amd64.whl (470.7 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

openTSNE-1.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.2 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

openTSNE-1.0.2-cp311-cp311-macosx_10_12_universal2.whl (1.0 MB view hashes)

Uploaded CPython 3.11 macOS 10.12+ universal2 (ARM64, x86-64)

openTSNE-1.0.2-cp310-cp310-win_amd64.whl (470.6 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

openTSNE-1.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.0 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

openTSNE-1.0.2-cp310-cp310-macosx_10_12_universal2.whl (1.0 MB view hashes)

Uploaded CPython 3.10 macOS 10.12+ universal2 (ARM64, x86-64)

openTSNE-1.0.2-cp39-cp39-win_amd64.whl (472.8 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

openTSNE-1.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.0 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

openTSNE-1.0.2-cp39-cp39-macosx_10_12_universal2.whl (1.0 MB view hashes)

Uploaded CPython 3.9 macOS 10.12+ universal2 (ARM64, x86-64)

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page