
Security News
RubyGems Adds Cooldown Feature to Bundler for Newly Published Gems
RubyGems and Bundler 4.0.13 introduced an opt-in cooldown feature that delays newly published gems during dependency resolution.
reinforcement-learning
Advanced tools
Easy reinforcement learning using tensorflow.js
Deep Q Network (DQN)
Genetic Algorithim (GA)
Examples
Training Dashboard (Tensorboard)
const rl = require('reinforcement-learning');
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 = require('reinforcement-learning');
let step = 0;
let arch = [
{inputShape: 1, units: 14, activation: 'relu'},
{units: 2, activation: 'softmax'}
];
function getState(){return [0];}
function calcReward(state, action){
// Every 100 steps end the episode
step++;
let episodeDone = false;
if(step === 100){episodeDone = true; step = 0;}
// Two armed bandit. Agent has to learn to always pick 1
if(action === 1)return {reward: 1, newState:[0], done: true, episodeDone};
else{ return {reward: 0, newState:[0], done: true, episodeDone}}
}
(async()=>{
let agent = rl.DQN({
arch,
epsilon: 0,
epsilonDecay: 0,
replayMemorySize: 1000,
miniBatchSize: 64,
actionSpaceSize: 2,
minReplaySize: 100,
updateTargetEvery: 1,
accuracyLookbackSize: 500
});
await agent.learn({accuracy: 95, getState, calcReward});
})();
FAQs
Reinforcement learning in javascript
The npm package reinforcement-learning receives a total of 35 weekly downloads. As such, reinforcement-learning popularity was classified as not popular.
We found that reinforcement-learning demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
RubyGems and Bundler 4.0.13 introduced an opt-in cooldown feature that delays newly published gems during dependency resolution.

Security News
pnpm 11.5 now recognizes npm staged publish approvals in release metadata, preventing those releases from being mistaken for lower-trust package publishes.

Security News
Federal audit finds NIST lacked a plan to clear the NVD backlog, wasted funds on duplicate work, and delayed use of CISA data.