Published
Edited
May 4, 2020
Importers
9 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// md`## Confidence`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
generate_convergences_table = (Y) => Array(Y+1).fill()
.map(
(_,j) => precalculated_sims_and_metrics[N][j]['sims_metrics']
).map(function(key, j) {
return {
j: j,
conv_value_for_mean: key['means_conv_val'],
conv_value_for_median: key['medians_conv_val'],
conv_value_for_mode: key['modes_conv_val'],
};
}
)
Insert cell
make_sims = (_input_j) => {
const j_seed = make_j_digit_seed(_input_j)
return Array(iters).fill().map( _ => Array(M).fill().map(
_ => xor_lists(
j_seed,
N_length_bitstring_with_prob_p(p)
).split("").map(_ => parseInt(_)).reduce((a, b) => a + b, 0)
))
}
Insert cell
simulate_progressive_mles = (_input_j, sims) => {
const mles = sims.map( run => run.map(
(num,i) => run.slice(0,i + 1)
).map( l => compute_max_likelihood_estimate(l, N))
)
return transpose(mles).map( r => r.map( m => m == _input_j ? 1 : 0 ).reduce((a, b) => a+b)/iters )
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// light_probs_general = Array(N+1).fill().map( (_,J) =>
// Array(N+1).fill()
// .map(
// (_,k) => k ).map(function(key) {
// return {Initial_lights: J, Remaining_lights: key, probability: conv_general(key, N, J) || 0};
// })
// ).flat()
Insert cell
Insert cell
Insert cell
conv_general = (i, n, J) => Math.pow(p, J - i) * Math.pow(1 - p, i - J) * conv_sum_general(i, n, J)
Insert cell
conv = (i) => Math.pow(p, j - i) * Math.pow(1 - p, i - j) * conv_sum(i)
Insert cell
conv_sum_general = (i, n, J) => Array(i+1).fill()
.map(
(_,k) => conv_sum_term_general(i, n, J, k)
)
.reduce((a,b) => a+b)
Insert cell
conv_sum = (i) => Array(i+1).fill()
.map(
(_,k) => conv_sum_term(i,k)
)
.reduce((a,b) => a+b)
Insert cell
Insert cell
conv_sum_term = (i, k) => Math.pow(p, 2*k) * Math.pow(1 - p, N - 2*k) * choose(N - j, k) * choose(j, i - k)
Insert cell
Insert cell
Insert cell
partial_sums_of_ss = dist_of_seed_sums.map(
(num,i) => dist_of_seed_sums.slice(0,i + 1)
.reduce((prev,curr) => prev + curr)
)

Insert cell
running_means_of_ss = partial_sums_of_ss.map((_,idx) => _/(idx+1))
Insert cell
running_medians_of_ss = dist_of_seed_sums.map(
(num,i) => dist_of_seed_sums.slice(0,i + 1)
).map(_ => _.sort()[Math.floor(_.length / 2)])
Insert cell
running_modes_of_ss = dist_of_seed_sums.map(
(num,i) => dist_of_seed_sums.slice(0,i + 1)
).map(_ => dist_to_counter_dict(_)).map(
obj => Object.keys(obj).reduce((a, b) => obj[a]['y'] > obj[b]['y'] ? a : b)
)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
String.prototype.b = function() { return parseInt(this,2); }
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import {vz} from "@bbischof/vizsla-and-vega-lite"
Insert cell
import {vl} from '@bbischof/vega-lite-api'
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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