terrencew / manifold

A package to manipulate manifolds.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Manifold

A package to manipulate manifolds, for Torch7.

Install

luarocks install manifold

Use

-- 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

Demos

Demos require gfx.js to be installed.

cd demos
th -x demo_swissroll.lua
th -x demo_tsne.lua
# (the -x flag starts the gfx server)

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

About

A package to manipulate manifolds.


Languages

Language:Lua 100.0%