wasm-bhtsne
TypeScript icon, indicating that this package has built-in type declarations

0.3.3 • Public • Published

wasm-bhtsne

License: MIT

This is the wasm version of the bhtsne crate.

Parallel implementations of Barnes-Hut and exact implementations of the t-SNE algorithm written in Rust to run in wasm. The tree-accelerated version of the algorithm is described with fine detail in this paper by Laurens van der Maaten. The exact, original, version of the algorithm is described in this other paper by G. Hinton and Laurens van der Maaten. Additional implementations of the algorithm, are listed at this page.

Installation

npm i wasm-bhtsne

Example

import init, { tSNE } from "wasm_bhtsne";

await init();

function createRandomMatrix(rows, columns) {
    return Array.from({ length: rows }, () =>
        Array.from({ length: columns }, () => Math.random())
    );
}

// create random points and dimensions
const data = createRandomMatrix(500, 4);

const tsne_encoder = new tSNE(data);

// as argument the number of epochs,
const compressed_vectors = tsne_encoder.barnes_hut(1000);

console.log("Compressed Vectors:", compressed_vectors);

Package Sidebar

Install

npm i wasm-bhtsne

Weekly Downloads

1

Version

0.3.3

License

MIT

Unpacked Size

179 kB

Total Files

6

Last publish

Collaborators

  • lv291