Public
Edited
Dec 1
16 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
sigmoid = (L, t0, k) => (t) => 0.5 + L / (1 + Math.exp(-k * (t - t0)))
Insert cell
objective = (n) => {
return ([L, t0, k]) => {
const S = sigmoid(L, t0, k);
return d3.sum(data.slice(0, n).map(([t, v]) => (S(t) - v) ** 2));
};
}
Insert cell
solution = n => fmin.nelderMead(objective(n), [10, 1, 1])
Insert cell
data = {
replay;

const S = sigmoid(L, t0, k);

const length = 100;
return Array.from({ length }, (_, i) => [
i / length,
S(i / length) + noise * (Math.random() - .5)
]);
}
Insert cell
fmin = require("fmin@0.0.2") // see https://github.com/benfred/fmin/pull/18
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