mixture tweaks
This commit is contained in:
parent
884adba214
commit
10941f00ac
1
fermi.go
1
fermi.go
|
@ -372,6 +372,7 @@ func parseMixture(words []string, vars map[string]Dist) (Dist, error) {
|
||||||
return nil, printAndReturnErr("Expected mixture variable but didn't get a variable. \nMixture syntax: \nmx x 2.5 y 8 z 10\ni.e.: mx var weight var2 weight2 ... var_n weight_n")
|
return nil, printAndReturnErr("Expected mixture variable but didn't get a variable. \nMixture syntax: \nmx x 2.5 y 8 z 10\ni.e.: mx var weight var2 weight2 ... var_n weight_n")
|
||||||
}
|
}
|
||||||
samples := dist.Samples()
|
samples := dist.Samples()
|
||||||
|
// Inefficient to draw N_SAMPLES for each of the distributions, but conceptually simpler.
|
||||||
dists = append(dists, dist)
|
dists = append(dists, dist)
|
||||||
fs = append(fs, samples)
|
fs = append(fs, samples)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package sample
|
package sample
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"math"
|
"math"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
@ -181,7 +180,7 @@ func Sample_mixture_serially(fs [][]float64, weights []float64, n_samples int) (
|
||||||
return nil, errors.New("Cummulative sum of weights in mixture must be > 0.0")
|
return nil, errors.New("Cummulative sum of weights in mixture must be > 0.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("Weights: %v\n", cumsummed_normalized_weights)
|
// fmt.Printf("Weights: %v\n", cumsummed_normalized_weights)
|
||||||
|
|
||||||
xs := make([]float64, n_samples)
|
xs := make([]float64, n_samples)
|
||||||
// var global_state = rand.New(rand.NewPCG(uint64(1), uint64(2)))
|
// var global_state = rand.New(rand.NewPCG(uint64(1), uint64(2)))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user