Public
Edited
Oct 9, 2021
Fork of Simple D3
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
nView = slider({
min: 10,
max: 500,
step: 10,
description: md`Number of Samples (${tex `n`})`
})
Insert cell
Insert cell
rView = slider({
min: 1,
max: 5,
step: 0.1,
description: md`Radius (${tex `r`})`
})
Insert cell
Insert cell
noiseVarianceView = slider({
min: 0.1,
max: 1,
step: 0.1,
description: md`Variance of Noise (${tex `\sigma_\epsilon^2`})`
})
Insert cell
noiseVariance = Generators.input(noiseVarianceView)
Insert cell
thetaView = slider({
min: 0,
max: 2*mathjs.pi + 0.1,
step: 0.1,
value: mathjs.pi / 4,
description: md`Angle (${tex `\theta`})`,
title: md`Parameters of ${tex `W`}`
})
Insert cell
theta = Generators.input(thetaView)
Insert cell
Insert cell
model = (n, mu=[0, 0]) => {
const noise = sample2DIsotropicNormal(n, noiseVariance)
const z = sample1DNormal(n)

const x = mathjs.multiply(z, W)
return {data: x, dataWithNoise: mathjs.add(x, noise)}
}
Insert cell
normalDist = d3.randomNormal(0, 1)
Insert cell
Insert cell
Insert cell
Insert cell
x = d3.scaleLinear().domain([-10, 10]).range([0, width])
Insert cell
y = d3.scaleLinear().domain([-10, 10]).range([height, 0])
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import {inputsGroup} from "@bumbeishvili/input-groups"
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