continue preparing for concurrency
This commit is contained in:
parent
1c8542bdc4
commit
e74c1127a5
18
probppl.go
18
probppl.go
|
@ -135,29 +135,25 @@ func main() {
|
||||||
|
|
||||||
var r = rand.New(rand.NewPCG(uint64(1), uint64(2)))
|
var r = rand.New(rand.NewPCG(uint64(1), uint64(2)))
|
||||||
|
|
||||||
n_dists := 10_000
|
n_dists := 10
|
||||||
var dists = make([]IntProbsWeights, n_dists)
|
var dists = make([]IntProbsWeights, n_dists)
|
||||||
|
|
||||||
sum_weights := int64(0)
|
for i := 0; i < n_dists; i++ {
|
||||||
for i := 0; i < 10_000; i++ {
|
|
||||||
|
|
||||||
people_known_distribution := generatePeopleKnownDistribution(r)
|
people_known_distribution := generatePeopleKnownDistribution(r)
|
||||||
// fmt.Println(people_known_distribution)
|
|
||||||
result := getUnnormalizedBayesianUpdateForDistribution(people_known_distribution, r)
|
result := getUnnormalizedBayesianUpdateForDistribution(people_known_distribution, r)
|
||||||
if i%10 == 0 {
|
if i%10 == 0 {
|
||||||
fmt.Printf("%d/10000\n", i)
|
fmt.Printf("%d/%d\n", i, n_dists)
|
||||||
}
|
}
|
||||||
if result > 0 {
|
if result > 0 {
|
||||||
// fmt.Println(people_known_distribution)
|
|
||||||
// fmt.Println(result)
|
|
||||||
dists[i] = IntProbsWeights{IntProbs: people_known_distribution, w: result}
|
dists[i] = IntProbsWeights{IntProbs: people_known_distribution, w: result}
|
||||||
}
|
}
|
||||||
sum_weights += result
|
|
||||||
// fmt.Println(result)
|
|
||||||
}
|
}
|
||||||
// fmt.Println(dists)
|
|
||||||
|
|
||||||
// Now calculate the posterior
|
// Now calculate the posterior
|
||||||
|
sum_weights := int64(0)
|
||||||
|
for _, dist := range dists {
|
||||||
|
sum_weights += dist.w
|
||||||
|
}
|
||||||
|
|
||||||
for i := int64(16); i <= 2048; i *= 2 {
|
for i := int64(16); i <= 2048; i *= 2 {
|
||||||
p := 0.0
|
p := 0.0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user