Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible bug in update_values? #83

Open
gaffney2010 opened this issue Feb 28, 2021 · 2 comments
Open

Possible bug in update_values? #83

gaffney2010 opened this issue Feb 28, 2021 · 2 comments

Comments

@gaffney2010
Copy link

The code in update_values does:

...
self.visit_count += 1

self.q_value += leaf_value / self.visit_count
...

So that if you call this three times with leaf_value 3, 4, 5, then q_value will be 3/1 + 4/2 + 5/3, since the visit_count gets updated while we increment q_value. This seems to contradict the description in the book as the average of leaf node values. (If I've understood correctly.)

@yliu000
Copy link

yliu000 commented Jun 4, 2021

I got same question.

@pocca2048
Copy link

me too.
I believe this should be:

self.q_value = (self.q_value * (self.visit_count-1) + leaf_value) / self.visit_count

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants