This commit is contained in:
a 2023-07-06 09:32:50 +01:00
parent 169a87fccc
commit 043c7982e6
1 changed files with 2 additions and 2 deletions

View File

@ -20,10 +20,10 @@ func (ucb *UCB) Select(r float64) int {
} }
sz := len(ucb.cr.Counts) sz := len(ucb.cr.Counts)
var res float64 var res float64
for _, v := range ucb.cr.Counts { for idx, v := range ucb.cr.Counts {
ans := math.Sqrt((2.0 * math.Log(float64(sz))) / float64(v)) ans := math.Sqrt((2.0 * math.Log(float64(sz))) / float64(v))
if ans > res { if ans > res {
res = ans res = float64(a) + ucb.cr.Rewards[idx]
} }
} }
return int(res) return int(res)