From e74c1127a5015c865f6bac123ceebeb14a416b3d Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Sun, 25 Feb 2024 19:07:20 -0300 Subject: [PATCH] continue preparing for concurrency --- probppl.go | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/probppl.go b/probppl.go index 75efece..1cec82c 100644 --- a/probppl.go +++ b/probppl.go @@ -135,29 +135,25 @@ func main() { var r = rand.New(rand.NewPCG(uint64(1), uint64(2))) - n_dists := 10_000 + n_dists := 10 var dists = make([]IntProbsWeights, n_dists) - sum_weights := int64(0) - for i := 0; i < 10_000; i++ { - + for i := 0; i < n_dists; i++ { people_known_distribution := generatePeopleKnownDistribution(r) - // fmt.Println(people_known_distribution) result := getUnnormalizedBayesianUpdateForDistribution(people_known_distribution, r) if i%10 == 0 { - fmt.Printf("%d/10000\n", i) + fmt.Printf("%d/%d\n", i, n_dists) } if result > 0 { - // fmt.Println(people_known_distribution) - // fmt.Println(result) dists[i] = IntProbsWeights{IntProbs: people_known_distribution, w: result} } - sum_weights += result - // fmt.Println(result) } - // fmt.Println(dists) // Now calculate the posterior + sum_weights := int64(0) + for _, dist := range dists { + sum_weights += dist.w + } for i := int64(16); i <= 2048; i *= 2 { p := 0.0