Published
Edited
Jul 19, 2019
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function generate_scales() {
return {
"x": d3.scaleLinear()
.domain([-1, 2])
.range([0, width]),
"h1": d3.scaleLinear()
.domain([-1.2, 1.2])
.range([height, height / 2]),
"h2": d3.scaleLinear()
.domain([-1.2, 1.2])
.range([height / 2, 0]),
"coord": d3.scaleOrdinal()
.domain([0, 1])
.range(["#cd5c5c", "#cd955c"])
}
}
Insert cell
Insert cell
function layer_2(x, weights, biases) {
var h_data = [];
for (var i = 0; i < x.length; i++) {
var h1 = Math.tanh(weights[0] * x[i] + biases[0]),
h2 = Math.tanh(weights[1] * x[i] + biases[1]);
h_data.push({
"x": x[i],
"h": Math.tanh(h1 + h2)
})
}
return h_data;
}
Insert cell
height = 300
Insert cell
d3 = require("d3-selection", "d3-selection-multi", "d3-scale", "d3-array", "d3-axis")
Insert cell
import {slider} from "@jashkenas/inputs"
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