A package to manipulate manifolds.
Switch branches/tags
Nothing to show
Clone or download
Latest commit b1d0958 Jul 3, 2017



A package to manipulate manifolds, for Torch7.


luarocks install manifold


In order to be able to run the binaries, you need to install the package libatlas3-base. On a Ubuntu machine you can execute the following commands.

sudo apt-get update
sudo apt-get install libatlas3-base


-- package:
m = require 'manifold'

-- a dataset:
t = torch.randn(100,10) -- 100 samples, 10-dim each

-- basic functions:
ns = m.neighbors(t) -- return the matrix of neighbors for all samples (sorted)
ds = m.distances(t) -- return the matrix of distances (L2)
ts = m.removeDuplicates(t) -- remove duplicates from dataset

-- embeddings:
p = m.embedding.random(t, {dim=2})  -- embed samples into a 2D plane, using random projections
p = m.embedding.lle(t, {dim=2, neighbors=3})  -- embed samples into a 2D plane, using 3 neighbor (LLE)
p = m.embedding.tsne(t, {dim=2, perplexity=30})  -- embed samples into a 2D plane, using tSNE


To run the demos, simply type the following commands.

cd demos
qlua demo_swissroll.lua
qlua demo_tsne.lua

Below is an example of a t-SNE map produced on 5,000 MNIST digits by the demos/demo_tsne.lua demo.

t-SNE map of 5,000 MNIST digits