Published
Edited
Aug 27, 2021
Fork of Simple D3
3 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
thresholdView = slider({
min: 0.2,
max: 1,
value: 0.3,
step: 0.1,
description: md`Neighbourhood Threshold`,
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
eigs = mathjs.eigs(laplacian)
Insert cell
eigs.values
Insert cell
numberOfClusters = eigs.values.filter(e => e <= eigValueThreshold).length
Insert cell
Insert cell
clusterAssignment = {
const clusterAssignment = Array.from({ length: data.length }).map(u => 0)
for (let i = 1; i < numberOfClusters; i++) {
const ev = mathjs.transpose(eigs.vectors)[i]
const embedding = mathjs.multiply(normalizedMatrix, ev)
embedding.forEach((magnitude, j) => {
if(magnitude > 0) {
clusterAssignment[j] = i
}
})

}
return clusterAssignment
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
showConnectionsView = Inputs.toggle({label: "Show Connections", value: true})
Insert cell
Insert cell
showClusterLabelView = Inputs.toggle({label: md`Show Clusters`, value: true})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
dataMax = Math.ceil(mathjs.max(mathjs.abs(data)))
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
mathjs = require('https://unpkg.com/mathjs@6.6.0/dist/math.min.js')
Insert cell
import {dataset_swiss_roll} from "@heytitle/stein-variational-gradient-descent"
Insert cell
import {slider} from "@jashkenas/inputs"
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