0.0.0 • Published 10 years ago
dqn v0.0.0
dqn
Train a Deep Q-Network on remote GPUs, but execute its policy in JS.
You send the agent state/reward pairs, the agent figures out how to take actions to maximize its reward.
usage
npm install dqnvar dqn = require('dqn')(TASK_ID)
var agent = dqn({
  actions: [
    function () {
      // do something in your environment
    },
    function () {
      // do something else in your environment
    }
  ]
})
agent.perceive({
  state: [1, 0, 0.7], // environment state encoded as an array of numbers. this must always be the same length!
  reward: 1           // the reward signal the agent should get for the current state (can be negative)    
})api
var dqn = require('dqn')(TASK_ID)var agent = dqn(params)
Create a reinforcement learning agent from params:
params.actions: array of action functions
agent.perceive(experience)
This method is how the agent will sense your environment. An agent will take an action once for each perceive() call. An experience should have:
experience.state: Array of numbers representing your environment's state. Can be RGB pixel values or some other representation.experience.reward: Positive or negative number. The agent is going to try to choose actions that maximize this number.
agent.reset()
Optional. In some environments (usually games) you may have self-contained episodes. Calling reset() when an episode ends can help speed up training.
If your environment doesn't have a clear "game over" event, don't worry about calling this method.
0.0.0
10 years ago