commit 94119e01739aaecb2a0d4d6138ba753f17fae160
parent b6addc7f05acab4ac9bd15e44cc64e3feb6787b3
Author: NunoSempere <nuno.sempere@protonmail.com>
Date: Sat, 3 Dec 2022 13:14:08 +0000
feat: rejiggle default number of samples.
Diffstat:
4 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/squiggle/node_modules/@quri/squiggle-lang/dist/src/rescript/MagicNumbers.bs.js b/squiggle/node_modules/@quri/squiggle-lang/dist/src/rescript/MagicNumbers.bs.js
@@ -14,7 +14,7 @@ var Epsilon = {
};
var Environment = {
defaultXYPointLength: 1000,
- defaultSampleCount: 10000,
+ defaultSampleCount: 1000000,
sparklineLength: 20
};
var OpCost = {
diff --git a/squiggle/node_modules/@quri/squiggle-lang/src/rescript/MagicNumbers.bs.js b/squiggle/node_modules/@quri/squiggle-lang/src/rescript/MagicNumbers.bs.js
@@ -19,8 +19,8 @@ var Epsilon = {
};
var Environment = {
- defaultXYPointLength: 1000,
- defaultSampleCount: 10000,
+ defaultXYPointLength: 1000000,
+ defaultSampleCount: 1000000,
sparklineLength: 20
};
diff --git a/squiggle/samples.js b/squiggle/samples.js
@@ -5,9 +5,22 @@ p_a = 0.8
p_b = 0.5
p_c = p_a * p_b
-result = mx([0, 1, 1 to 3, 2 to 10], [(1 - p_c), p_c/2, p_c/4, p_c/4 ])
+dist_0 = 0
+dist_1 = 1
+dist_some = SampleSet.fromDist(1 to 3)
+dist_many = SampleSet.fromDist(2 to 10)
+
+dists = [dist_0, dist_1, dist_some, dist_many]
+weights = [(1 - p_c), p_c/2, p_c/4, p_c/4 ]
+
+result = mixture(dists, weights)
mean(result)
+
`
-let output = run(squiggle_code)
+let output = run(squiggle_code, {
+ defaultXYPointLength: 1000000,
+ defaultSampleCount: 1000000,
+ sparklineLength: 20,
+})
console.log(output.result.value)
diff --git a/squiggle/samples.squiggle b/squiggle/samples.squiggle
@@ -2,5 +2,13 @@ p_a = 0.8
p_b = 0.5
p_c = p_a * p_b
-result = mx([0, 1, 1 to 3, 2 to 10], [(1 - p_c), p_c/2, p_c/4, p_c/4 ])
-mean(result)
-\ No newline at end of file
+dist_0 = 0
+dist_1 = 1
+dist_some = SampleSet.fromDist(1 to 3)
+dist_many = SampleSet.fromDist(2 to 10)
+
+dists = [dist_0, dist_1, dist_some, dist_many]
+weights = [(1 - p_c), p_c/2, p_c/4, p_c/4 ]
+
+result = mixture(dists, weights)
+mean(result)