Published
Edited
Oct 2, 2019
2 forks
Importers
1 star
Insert cell
Insert cell
simulationSampleCount = 10000
Insert cell
outputSampleCount = 1000
Insert cell
smoothingWidth = 100;
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import {vl} from "@vega/vega-lite-api"
Insert cell
Insert cell
cdfLib = require('https://bundle.run/@foretold/cdf@1.0.9')
Insert cell
function guesstimatorInputToCdf({
guesstimatorInput,
simulationSampleCount,
outputSampleCount,
smoothingWidth,
min,
max
}) {
let toSamples = inputToSamples({
input: guesstimatorInput,
simulationSampleCount
});
var samp = new cdfLib.Samples(toSamples.values);
return samp.toCdf({
size: outputSampleCount,
width: smoothingWidth,
min,
max
});
}
Insert cell
asCdf = guesstimatorInputToCdf({
guesstimatorInput: guesstimatorInput,
outputSampleCount,
smoothingWidth,
simulationSampleCount
})
Insert cell
zipp = (cdf) => cdf.xs.map((a,i) => ({x:cdf.xs[i], y:cdf.ys[i]}))
Insert cell
minToShow = asCdf.findX(0.0001);
Insert cell
maxToShow = asCdf.findX(0.99);
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