wrangle mixture syntax
This commit is contained in:
parent
651ade8b47
commit
4544adb3d0
|
@ -1,5 +1,7 @@
|
||||||
- [x] Hello world program
|
- [x] Hello world program
|
||||||
- [x] Look into randomness sources in go
|
- [x] Look into randomness sources in go
|
||||||
- rand/v2 api: <https://pkg.go.dev/math/rand/v2>
|
- rand/v2 api: <https://pkg.go.dev/math/rand/v2>
|
||||||
- [ ] Test with a million samples of a simple lognormal, just to get a sense of speed
|
- [x] Test with a million samples of a simple lognormal, just to get a sense of speed
|
||||||
- [ ] Add mixture distribution
|
- [ ] Add mixture distribution
|
||||||
|
- [ ] Look into go routines for filling up an array.
|
||||||
|
- [ ] Anonymous functions for nested: https://stackoverflow.com/questions/74523441/nested-functions-in-go
|
||||||
|
|
|
@ -47,6 +47,12 @@ func sample_to(low float64, high float64) float64 {
|
||||||
return math.Exp(sample_normal_from_90_ci(loglow, loghigh))
|
return math.Exp(sample_normal_from_90_ci(loglow, loghigh))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type func64 func() float64
|
||||||
|
|
||||||
|
func sample_mixture(fs [](func(float64) float64), ps []float64) float64 {
|
||||||
|
return 1.0
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var n_samples int = 1000000
|
var n_samples int = 1000000
|
||||||
// var array_samples [n_samples]float64
|
// var array_samples [n_samples]float64
|
||||||
|
@ -57,4 +63,10 @@ func main() {
|
||||||
avg = avg / float64(n_samples)
|
avg = avg / float64(n_samples)
|
||||||
fmt.Printf("%v\n", avg)
|
fmt.Printf("%v\n", avg)
|
||||||
|
|
||||||
|
f1 := func() float64 {
|
||||||
|
return sample_to(1, 10)
|
||||||
|
}
|
||||||
|
|
||||||
|
fs := [3](func64){f1, f1, f1}
|
||||||
|
// x := sample_mixture()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user