Public
Edited
Oct 21, 2024
2 forks
Importers
15 stars
Hello, PGLiteINSEE ParquetHello, apcach
DruidJS worker
Hello, OrbitWord Tour: 40k words and their friendsHello, spectral.jsHello, petite-vueHello, @thi.ng/grid-iteratorsHello, thumbhashHello, SwissGLHello, QOI (and glitches)Hello, orbHello, cosmographHello, TabulatorUsing d3.blur with PlotMath.cbrtHello debounceColorcetHello, gliiHello, Open MeteoHello, PyWaveletsHello, typesenseHello, libgifHello, kmeans-engineHappy anniversary, Project Gutenberg!Hello, fflateHello, ArchieML!Hello, d3-bboxCollideHello, jsgeoda!Hello, EDTF!Hello, protovis!Hello, placekeyHello, fuse.jsHello, Reorder.jsHello, shadow DOMjszipHello, procedural-glHello, qhullHello, genetic-jsDruidJSHello, Tippy.jsHello, paintWorkletBig πHello, AutoencoderHello, Shakespearean UUIDsHello, ccwt.jsHello, constrainautorHello, talismanHello, polygon-offsetHello p-queueHello async-poolHello rollup-plugin-asciiHello, algebra.jsHello, pixi.jsHello, d3-renderHello zip/unzipCumulative Wikipedia DonationsHTML <details>regl textureHello, npyjsHello protobufHello, pencil touchHello, LOESSHello html2canvaslegra mapscolor2cssHello, ecsy2D point distributionsHello, delatinThe gpu.js loopDijkstra’s shortest-path treeHello nojacko/Dijkstras-jsHello, tcort/dijkstrajsHello, lambdabaa/dijkstraHello, gpu.js v2Hello jsqrHello qrcodeHello SharedArrayBufferHello GamePad APIHello vtk.jsHello nd4jsHello BiofabricTravelling with a self-organizing mapHello glitchHello UMAP-jsHello pandemoniumHello iocaneHello JSON-editorHello d3-griddingHello mljs/knnWorkerHello lalolibImage to GPU.jsImage to blink.jsTissot's indicatrixVega projectionsHello WebCLGLUsing d3-inertia with observableVideo contouring 3ngraph: pagerank, louvain…Union-FindPerceptron (simple statistics)mljsHello h3-jsEmoji FlagsHello, poisson-disk-sampling
Also listed in…
Clustering
Algorithms
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// replaces `result = new druid.UMAP(data).transform()`
// Use Generators.observe for faster lookups
result = Generators.queue(
worker(
function* dr({ dr_method, data, dynamic }) {
// see https://github.com/saehm/DruidJS/issues/34#issuecomment-1671538179
// and https://github.com/saehm/DruidJS/issues/13#issuecomment-718252666
if (dynamic) {
yield* self.druid[dr_method].generator(data, {}); // show the steps
} else {
yield self.druid[dr_method].transform(data, {}); // show the end result
}
},
{ dr_method, data: normalized, dynamic },
`
importScripts(${JSON.stringify(
await require.resolve("@saehrimnir/druidjs@^0.7.3")
)});
`
)
)
Insert cell
Insert cell
import {worker} from "@fil/worker"
Insert cell
Insert cell
penguins_without_nan = penguins.filter((d) =>
columns.every((c) => !isNaN(d[c]))
)
Insert cell
normalized = {
const A = Array.from(penguins_without_nan, () => []);
for (const [k, c] of columns.entries()) {
const channel = Plot.valueof(penguins_without_nan, c);
const mean = d3.mean(channel);
const max = d3.max(channel);
const deviation = d3.deviation(channel);
for (let i = 0; i < channel.length; ++i) {
A[i][k] =
normalizeBy === "max"
? channel[i] / max
: normalizeBy === "deviation" || normalizeBy === "z-score" // alias
? (channel[i] - mean) / deviation
: normalizeBy === "log"
? Math.log10(channel[i])
: NaN; // unsupported method
}
}
return A;
}
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