Published
Edited
Mar 15, 2020
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
tf.tensor([1, 2, 3, 4])
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
const tfdata = tf.randomUniform([2000,10]);
const tsneOpt = tf.tsne.tsne(tfdata);
var a = tsneOpt.compute()
a.then(d => console.log(d)).catch(d => console.log(d))
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// help! not sure why the graph is not rendered automatically. when running manually it works.
Insert cell
Insert cell
//DOM.download(serialize(data, grid), "gid.csv", "Download grid positions")
Insert cell
//DOM.download(serialize(data, coordinates), "tsne.csv", "Download tsne positions")
Insert cell
//DOM.download(serialize(data, force), "force.csv", "Download force positions")
Insert cell
Insert cell
Insert cell
{
const data = tf.randomUniform([2000,10]);

// Get a tsne optimizer
const tsneOpt = tf.tsne.tsne(data);

// Compute a T-SNE embedding, returns a promise.
// Runs for 1000 iterations by default.
tsneOpt.compute().then(() => {
// tsne.coordinate returns a *tensor* with x, y coordinates of
// the embedded data.
const coordinates = tsneOpt.coordinates();
coordinates.print();
}) ;

}
Insert cell
Insert cell
Insert cell
// tsne = require('@tensorflow/tfjs-tsne')
// tsne = require("http://localhost:8000/dist/tfjs-tsne.js")
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more