Machine Learning

An Introduction

By @ajlopez

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

Uses

  • Text classification: spam detection
  • Ranking items: priority inbox
  • Regression models: predicting page views
  • Regularization: text regression
  • Optimization: code breaking
  • Unsupervised learned: building a stock market index
  • Spatial similarity: clustering US Senators by the voting records
  • Recommendation system: suggesting R packages to users
  • Social network analysis: who to follow on Twitter
  • Underwriting: approve loans

Main Source: Machine Learning for Hackers

Flavours

  • Reinforcement Learning + Interact with an Environment
  • Data + Supervised Learning
  • Data + Unsupervised Learning

Algorithms

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

Games

War Games

Checkers

By Arthur Samuels, IBM, 1959

Tree Search

TD-Gammon

http://www.bkgm.com/articles/tesauro/tdl.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

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

Other Algorithms

Decision Trees

K-Nearest Neighbours

Ensemble Learning

Finance Sector

Zest

The End

BY Angel 'Java' Lopez / @ajlopez