Having trouble understanding the Agent class
UsaidPro opened this issue · comments
Hello! I'm trying to do reinforcement learning using NeuroJS. Looking at the code, it appears that the Agent class is the backbone for the reinforcement learning in NeuroJS. I'm having trouble understanding it.
Are these the only steps required to use this library for reinforcement learning:
- Create Agent object (only feeding in number of states and actions)
- Call Agent.policy() for some time (do I call act()? simulate()? evaluate()?)
- Call Agent.learn()`
Is there anything else needed? Also, is there a .reset() "function" that lets me remove the history of the Agent, but keep the learned weights/values?
Thanks for creating this repository!
Hi. Yes, that's right. If you take a look at the waterworld/rldemo.js
file, you can see that you simply have to call policy
with a given state to obtain an action from the agent. And call learn
with the reward to let the agent improve. Easy as that ;-)
Currently there is no reset
function but I guess it would be very easy to implement. Just take a look at the Window
class and remove all the entries from an agent's history.
Thanks for the clarification! I'll just close this issue then.