JavaScript and Machine Learning

Some Algorithms and Samples

By @ajlopez

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

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

https://github.com/ajlopez/JavaScriptAI

Using reveal.js

Machine Learning

Definitions?

The science of getting computers to act without being explicitly programmed

The construction and study of algorithms that can learn from and make predictions on data

The creation of a model from example inputs in order to make data-driven predictions or decisions

Learning from experience either with or without supervision from humans

Algorithms

  • K-Nearest Neighbours
  • Decision Trees
  • Support Vector Machines
  • Neural Networks
  • Genetic Algorithms
  • Evolutionary Programs
  • Distributed ...
  • ...

Decision Trees

Lenses

https://github.com/ajlopez/SimpleDT/tree/master/samples/lenses

Scoring

https://github.com/ajlopez/SimpleDT/tree/master/samples/scoring/german

Genetic Algorithms

Search for a Solution to a Problem

Stochastic Search Algorithms

Essentially, Reinformence Learning Algorithms: Fitness

Genotype

  • Represents a solution/individual
  • Composed by "genes"
  • Evaluation of Performance
  • Mutation
  • Crossover

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

Evolutionary Programs

Evolving Animals

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

Codified Program

Bloomberg Stock Trading Game

http://www.bloomberg.com/features/2015-stock-chart-trading-game/

Systematic Trading

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

The End

BY Angel 'Java' Lopez / @ajlopez