0.1.2 • Published 6 years ago

qlearning v0.1.2

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

Q-Learning in node.js

Build Status TypeScript


DISCLAIMER: This library is still a WORK IN PROGRESS and is currently INCOMPLETE use at your own risk

Interested in doing reinforcement learning in node.js? Me too.

This is an experimental library to provide an interface for working with Q-Learning inside your node application.

import QL from 'qlearning'

const initialState = {x: 0, y: 0}
const learningRate = 0.35
const actions = ['forward', 'backwards', 'left', 'right']

const agent = new QL('name', actions, learningRate)

// What is the cost of moving to the specified `state` and taking `action`
agent.setCost((state, action) => {})
// What is the reward for `state`
agent.setReward((state) => {})
// Generate the next state given `state` and taking `action`
agent.setStateGenerator((state, action) => {})

// Let's get going!
agent.start(initialState)

This is essentially a rewrite of the open-source library q-exp by starcolon but to be more comprehensible (imo)