Skip to main content

t-SNE accelerated with PyTorch

Project description

t-SNE pytorch Implementation with CUDA

CUDA-accelerated PyTorch implementation of the t-stochastic neighbor embedding algorithm described in Visualizing Data using t-SNE.

Installation

Requires Python 3.7

Install via Pip

pip3 install tsne-torch

Install from Source

git clone https://github.com/palle-k/tsne-pytorch.git
cd tsne-pytorch
python3 setup.py install

Usage

from tsne_torch import TorchTSNE as TSNE

X = ...  # shape (n_samples, d)
X_emb = TSNE(n_components=2, perplexity=30, n_iter=1000, verbose=True).fit_transform(X)  # returns shape (n_samples, 2)

Command-Line Usage

python3 -m tsne_torch --xfile <path> --yfile <path>

Example

This is our result compare to result of python implementation.

  • PyTorch result

pytorch result

  • python result

python result

Credit

This code highly inspired by

  • author's python implementation code here.

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

tsne-torch-1.0.1.tar.gz (5.3 kB view hashes)

Uploaded Source

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