qdrant-web-ui icon indicating copy to clipboard operation
qdrant-web-ui copied to clipboard

[Visualization] Try to use WASM tSNE implementation

Open generall opened this issue 2 years ago • 1 comments

https://github.com/Lv-291/wasm-bhtsne

generall avatar Aug 30 '23 11:08 generall

Example usage

import { tSNE } from "wasm-bhtsne";

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

// create random points and dimensions
const data = createRandomMatrix(5000, 512);

const tsne_encoder = new tSNE(data);

let compressed_vectors = []

for (let i = 0; i < 1000; i++) {
    // as argument the number of epochs,
    compressed_vectors = tsne_encoder.barnes_hut(1);
}


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

generall avatar Sep 04 '23 19:09 generall