This commit is contained in:
parent
2f1636a33c
commit
5f5c236213
|
@ -2,9 +2,12 @@ package algo
|
|||
|
||||
import (
|
||||
"lukechampine.com/frand"
|
||||
"tuxpa.in/a/gambit"
|
||||
"tuxpa.in/a/gambit/helper"
|
||||
)
|
||||
|
||||
var _ gambit.Bandit = (*EpsilonGreedy)(nil)
|
||||
|
||||
type EpsilonGreedy struct {
|
||||
Epsilon float64
|
||||
cr helper.CountReward
|
||||
|
|
|
@ -17,13 +17,12 @@ func main() {
|
|||
|
||||
n := 100
|
||||
for i := 0; i < n; i++ {
|
||||
b.Update(
|
||||
g.Observe(
|
||||
// select a random arm
|
||||
b.Select(frand.Float64()),
|
||||
frand.Float64(),
|
||||
// and supply a random score
|
||||
float64(frand.Intn(4)),
|
||||
)
|
||||
}
|
||||
|
||||
log.Println(g.AllocateSolution())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue