shakedzy / notebooks Goto Github PK
View Code? Open in Web Editor NEWSome notebooks
Some notebooks
Hi,
I have found one issue with 'Learning to Play Acrobot with Actor-Critic' notebook. Please check it out and let me know if I'm right:
You call learning method (actor_cost, critic_cost = ac.learn(sess)) with every step of game play - it means that update is not done in batches, although your networks (Actor and Critc) are build properly to update with batches of data (placeholders have batch axis).
In your 'Q Learning and Deep Q Network' notebook you note that the algorithm, while right, didn't always have good values for some actions. This can be fixed by adding in alpha to the Q Table update:
`q_table.loc[action,state_to_str(state)] = (1-alpha) * q_table.loc[action,state_to_str(state)] + alpha * (reward + gamma * next_state_max_q_value)`
With alpha = 0.1 and gamma = 0.95 you'll find the Q Table looks much better.
board: [0 0 0 0] predicted Q values: [4, 4, 4, 4] best action: 0 correct action? True
board: [0 0 0 1] predicted Q values: [3, 1, 3, 2] best action: 0 correct action? True
board: [0 0 1 0] predicted Q values: [3, 0, 2, 3] best action: 0 correct action? True
board: [0 0 1 1] predicted Q values: [2, 0, 0, 0] best action: 0 correct action? True
board: [0 1 0 0] predicted Q values: [3, 0, 3, 0] best action: 0 correct action? True
board: [0 1 0 1] predicted Q values: [2, 0, 0, 0] best action: 0 correct action? True
board: [0 1 1 0] predicted Q values: [2, 0, -1, 0] best action: 0 correct action? True
board: [0 1 1 1] predicted Q values: [0, 0, 0, 0] best action: 0 correct action? True
board: [1 0 0 0] predicted Q values: [2, 3, 3, 3] best action: 1 correct action? True
board: [1 0 0 1] predicted Q values: [1, 2, 2, 0] best action: 1 correct action? True
board: [1 0 1 0] predicted Q values: [1, 2, 1, 2] best action: 1 correct action? True
board: [1 0 1 1] predicted Q values: [-1, 1, 0, 0] best action: 1 correct action? True
board: [1 1 0 0] predicted Q values: [1, 1, 2, 2] best action: 2 correct action? True
board: [1 1 0 1] predicted Q values: [0, 0, 1, 0] best action: 2 correct action? True
board: [1 1 1 0] predicted Q values: [0, 0, 0, 1] best action: 3 correct action? True
With your current code, each update forgets what was learned before.
Or you could use the Temporal Difference equation in Josh Stern's code that you point to.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.