time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

samples.squiggle (277B)


      1 p_a = 0.8
      2 p_b = 0.5
      3 p_c = p_a * p_b
      4 
      5 dist_0 = 0
      6 dist_1 = 1
      7 dist_some = SampleSet.fromDist(1 to 3)
      8 dist_many = SampleSet.fromDist(2 to 10)
      9 
     10 dists = [dist_0, dist_1, dist_some, dist_many]
     11 weights = [(1 - p_c), p_c/2, p_c/4, p_c/4 ]
     12 
     13 result = mixture(dists, weights)
     14 mean(result)