JavaScript and Artificial Intelligence

The Next Frontier

Created by @ajlopez

https://github.com/ajlopez/Talks/JavaScriptAI

https://github.com/ajlopez/JavaScriptAI

Using reveal.js

Agenda

  • Artificial Intelligence
  • Genetic Algorithms
  • Neural Networks
  • Evolutionary Programs
  • Critique

Artificial Intelligence

Decades of AI

  • The Study and Design of Intelligent Agents
  • Reasoning
  • Knowledge
  • Planning
  • Natural Language
  • Learning

Tools

  • Logic Programming
  • Knowledge Representation
  • Expert Systems
  • Neural Networks
  • Genetic Algorithms
  • ...

Artificial Intelligence, a Modern Approach

http://aima.cs.berkeley.edu/

Board Games

War Games

Tree Search

Backgammon

Tree Search

https://github.com/ajlopez/SimpleGammon/tree/master/samples/html

Genetic Algorithms

Genotype

Generic Structure

## Creating and Running Populations ```js for (var k = 0; k < 1000; k++) genotypes.push(Path.createGenotype(/* ... */)); var mutators = []; for (var k = 0; k < 4; k++) mutators.push(Path.createMutator()); engine = new simplega.Engine({ minimize: true }); engine.setPopulation(genotypes); engine.setMutators(mutators); // var newgenotypes = engine.nextPopulation(); best = simplega.getBestGenotype(newgenotypes, { minimize: true }); ```

Path Sample

https://github.com/ajlopez/SimpleGA/blob/master/samples/path/path.html

Neural Networks

Artificial Neuron

Many Layers

## Creating and Training a Network ```js var network = sn.network([6, 10, 3]); var outputs = network.outputs([0, 0, 1, 1, 0, 0]); console.dir(outputs); for (var k = 0; k < 20; k++) { network.train([0, 0, 1, 1, 0, 0], [0, 1, 0], 0.1); // .... } ```

Digits

https://github.com/ajlopez/SimpleNeuron/tree/master/samples/digits

ConvNetJS

Deep Learning in your browser

http://cs.stanford.edu/people/karpathy/convnetjs/ https://github.com/ajlopez/JavaScriptAI/tree/master/static

ConvNetJS Cifar10

https://github.com/ajlopez/JavaScriptAI/tree/master/static

Evolutionary Programs

Evolving Animals

https://github.com/ajlopez/SimpleGA/tree/master/samples/evol

The Next Frontier

Intelligent Agent

NodeBots

http://nodebots.io/

Resources

https://github.com/ajlopez/JavaScriptAI

The End

BY Angel 'Java' Lopez / @ajlopez