reinforcement-learning
Easy reinforcement learning using tensorflow.js
-
Deep Q Network (DQN)
-
Genetic Algorithim (GA)
-
Examples
-
Training Dashboard (Tensorboard)
Require
const rl = ;
DQN
Parameters
-
arch
- Architechture of the neural network -
epsilon
- % of actions that should be taken randomly for exploration -
epsilonDecay
- Epsilon will be multiplied by this amount every episode -
replayMemorySize
- Amount of previous steps left in memory to train on -
miniBatchSize
- Batch size to fit on -
actionSpaceSize
- Amount of possible actions the agent can take -
minReplaySize
- Minimum amount of memories allowed for fitting -
updateTargetEvery
How many episodes to wait to update the predictions network -
accuracyLookbackSize
How many previous steps should be used to calculate accuracy
const rl = ;let step = 0; let arch = inputShape: 1 units: 14 activation: 'relu'units: 2 activation: 'softmax'; {return 0;} {// Every 100 steps end the episodestep++;let episodeDone = false;ifstep === 100episodeDone = true; step = 0; // Two armed bandit. Agent has to learn to always pick 1ifaction === 1return reward: 1 newState:0 done: true episodeDone;else return reward: 0 newState:0 done: true episodeDone} asynclet agent = rl; await agent; ;