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

Fixed a bug on coping ndarray. #1

Merged
merged 1 commit into from
Nov 1, 2016
Merged

Fixed a bug on coping ndarray. #1

merged 1 commit into from
Nov 1, 2016

Conversation

kentan
Copy link
Contributor

@kentan kentan commented Nov 1, 2016

At current code, just reference was copied.

and so modifying newStateValue affected stateValue also.

As a result, np.sum(np.abs(newStateValue - stateValue)) was always 0 at the 2nd time of the loop.

…pied

and so modifing newStateValue affected stateValue also.

As a result, np.sum(np.abs(newStateValue - stateValue)) was always 0 at the
2nd time of the loop.
@ShangtongZhang
Copy link
Owner

Thanks very much for pointing this out. I just came from C++. Once I thought numpy has an overload for = operation between ndarray ... It seems I need to check all my code. Hope I don't need too much changes, I remember I also use np.copy in many places. Thanks again!

@ShangtongZhang ShangtongZhang merged commit 16530d9 into ShangtongZhang:master Nov 1, 2016
@ShangtongZhang
Copy link
Owner

Thanks god it seems only this example has this bug. If I reinitialize newStateValue in while loop, this bug can also be avoided -- Before using np.copy, I did so in many other examples. Thanks a lot!

@kentan
Copy link
Contributor Author

kentan commented Nov 1, 2016

Thank you for merging the code. The project is really helpful to understand the book and reinforcement learning.

@ShangtongZhang
Copy link
Owner

Hi kentan, would you mind giving me your name and email address? I wanna add you to the contributor list at the header of this file

@kentan
Copy link
Contributor Author

kentan commented Nov 17, 2016

That would be nice.
name : Kenta Shimada
email address : hyperkentakun@gmail.com

ShangtongZhang pushed a commit that referenced this pull request May 21, 2020
Update grid_world.py to include exact value computations
AlejandroPenacho pushed a commit to AlejandroPenacho/reinforcement-learning-an-introduction that referenced this pull request Jan 20, 2022
AlejandroPenacho pushed a commit to AlejandroPenacho/reinforcement-learning-an-introduction that referenced this pull request Jan 20, 2022
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

Successfully merging this pull request may close these issues.

2 participants