Platform
Resources
Pricing
Sign in
Get started
Pat Chormai
Workspace
Fork
Public
Machine Learning Concepts
By
Pat Chormai
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.
Try it for free
Learn more
Compare fork
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
explanation
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
resample
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
svg
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
values
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
W
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
nView
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
n
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
rView
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
r
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
noiseVarianceView
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
noiseVariance
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
thetaView
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
theta
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
model
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
normalDist
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
sample1DNormal
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
sample2DIsotropicNormal
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
x
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
y
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
dotRadius
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
height
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
width
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
mathjs
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML