Public
Edited
Jul 29, 2021
Importers
10 stars
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
Insert cell
Insert cell
KDELengthScaleView = slider({
title: "KDE Parameter",
min: 0.01,
max: 1,
value: 0.3, // this can be from dataset
step: 0.01,
precision: 4,
description: html`RBF Kernel Length Scale (${tex `l_\text{KDE}`})`
})
Insert cell
KDELengthScale = Generators.input(KDELengthScaleView)
Insert cell
Insert cell
score = (p) => {
const px = kde(p)
const mean = mathjs.mean(
trainingData.map(d => rbf_for_kde.grad(p, d)),
0
)
return mathjs.multiply(mean, 1 / px)
}
Insert cell
Insert cell
Insert cell
{
chart.update(current_epoch)
chart.showParticleTrajectory(isShownParticleTrajectory)
}
Insert cell
SVGDLengthScaleView = slider({
min: 0.01,
max: 1,
value: 0.3, /// default from dataset
step: 0.01,
precision: 2,
description: html`Kernel Length Scale (${tex `l_\text{SVGD}`})`}
)
Insert cell
Insert cell
lrView = slider({
min: 0.0001,
max: 0.8,
value: 0.3,
precision: 2,
step: 0.01,
description: html`Learning Rate (${tex `\gamma`})`,
title: "SVGD Parameters",
})
Insert cell
Insert cell
numberofEpochsView = slider({
min: 10,
max: 200,
value: 100,
step: 10,
description: html`Number of Epochs (${tex `T`})`
})
Insert cell
Insert cell
totalParticlesView = slider({
min: 10,
max: 200,
value: 50, // default from dataset
step: 10,
description: html`Number of Particles (${tex `M`}); the larger large value the higher latency.`}
)
Insert cell
Insert cell
Insert cell
mutable particles = {
resetParticles;
dataset;
return Array.apply(null, Array(totalParticles)).map(() => [uniformSamplingInRange(-maxVal, maxVal), uniformSamplingInRange(-maxVal, maxVal)])
}
Insert cell
Insert cell
Insert cell
Insert cell
showParticleTrajectoryView = checkbox(
{label: html`Show Particle Trajectory`, checked: false}
)
Insert cell
isShownParticleTrajectory = Generators.input(showParticleTrajectoryView)
Insert cell
showDataView = checkbox({
title: "Visualization",
label: "Show Data",
checked: false
})
Insert cell
showData = Generators.input(showDataView)
Insert cell
showScoreView = checkbox({
label: html`Show Score Vector Field ${tex `\nabla_{\mathbf x}\log \hat p (\mathbf x)`}`,
checked: false
})
Insert cell
showScore = Generators.input(showScoreView)
Insert cell
showContour = Generators.input(showContourView)
Insert cell
showContourView = checkbox({
label: "Show Contour",
checked: true
})
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
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
height = 400
Insert cell
width = 400
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

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