Skip to content

Commit

Permalink
fix: weight randomization
Browse files Browse the repository at this point in the history
  • Loading branch information
viktordanov committed Oct 29, 2023
1 parent 1eaf508 commit 1eafbac
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions production_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,7 @@ func (bp *ByteProductionRule) RandomizeWeights(delta float64) {

total := 0.0
for i := 0; i < len(bp.Weights); i++ {
random := rand.Float64()
_, tokens := bp.findSuccessorByProbability(random)
for _, token := range tokens {
currentWeights[token] += delta - rand.Float64()*2*delta
}
currentWeights[i] += delta - rand.Float64()*2*delta

bp.Weights[i].LowerLimit = total
total += currentWeights[i]
Expand Down

0 comments on commit 1eafbac

Please sign in to comment.