Giter Site home page Giter Site logo

tsne's Introduction

Fast TSNE

This is a fork of Multicore t-SNE cython wrapper. This code has similar speed with Multicore t-SNE. In addition, support partial fitting function to continuously add points into tsne map.

How to use

Cython wrappers are available.

Python

Pre-Requirements

  • Python3
  • Numpy (>=1.18.0)
  • Cython (>=0.28.2)
  • cysignals
  • cmake
  • OpenMP 2(slow if not install)

Install

pip install numpy cython cysignals
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=RELEASE --DPYTHON_EXECUTABLE=$(which python) ..
make
make install

UnInstall

pip uninstall PyFastTsne

Tested with 3.6 (conda) and Ubuntu 16.04.

Run

You can use it as a near drop-in replacement for sklearn.manifold.TSNE.

from PyFastTsne import PyTsne

x_dim = 728
y_dim = 2
tsne = PyTsne(x_dim, y_dim)
Y = tsne.fit_transform(X)

## continuously add extra points 
tsne = tsne.partial_fit(extra_X, ret_Y, n_iter=300)

Please refer to sklearn TSNE manual for parameters explanation.

This implementation n_components=2, which is the most common case (use Barnes-Hut t-SNE or sklearn otherwise). Also note that some parameters are there just for the sake of compatibility with sklearn and are otherwise ignored. See MulticoreTSNE class docstring for more info.

Test

You can test it on MNIST dataset with the following command:

cd build/PyFastTsne
python test.py

License

Inherited from original repo's license.

Future work

  • Allow other types than double
  • Improve step 2 performance (possible)

Citation

tsne's People

Contributors

balansky avatar

Watchers

 avatar  avatar

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.