A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... ·...

59
NEUROEVOLUTION The hitchhiker’s guide to neuroevolution in Erlang. Jeroen Soeters

Transcript of A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... ·...

Page 1: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

NEUROEVOLUTION

The hitchhiker’s guide to neuroevolution in Erlang.

J e r o e n S o e t e r s

Page 2: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

The hitchhiker’s guide to NEUROEVOLUTION IN ERLANGJeroen Soeters

2

Page 3: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

FULL BLEED PHOTO WITH TYPE OVERLAYThis is useful when you have a nice photo or color-block as a background. On this slide only, you can put your

elements behind a master element.

3

Page 4: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

FULL BLEED PHOTO WITH TYPE OVERLAYThis is useful when you have a nice photo or color-block as a background. On this slide only, you can put your

elements behind a master element.

4

Page 5: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

UNTINTED PHOTOUse with care.

5

Page 6: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

YOUR BASIC, HARD-WORKING CONTENT SLIDE

A content headline

Did you know demoting a line turns it into body copy like you see here. Then promoting

it again makes it a …

Headline.

And back down to body by demoting.

■ Demote again for a bullet

■ Enter begins the next bullet

● Demote again for sub-bullets

- And again for tiny bullets

6

Page 7: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

50/50 CONTENT SPLIT

A content headline

Did you know demoting a line turns it into body copy like you see here. Then promoting

it again makes it a …

Headline.

And back down to body by demoting.

7

Page 8: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

LONG FORM CONTENT

Sometimes we use PowerPoint for page layout.

And in that case we need room for body copy. That’s what this slide is

for.

You can still create bullets

■ By hitting tab

Inline headline

Nullam id dolor id nibh ultricies vehicula ut id elit. Cras mattis

consectetur purus sit amet fermentum. Nulla vitae elit libero, a

pharetra augue. Duis mollis, est non commodo luctus, nisi erat

porttitor ligula, eget lacinia odio sem nec elit.

8

“Sometimes you need a

quote and you’ll have to

copy this block since

there’s no way to

predefine a quote style.”

Page 9: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

9

Sometimes you need a blank template.

Page 10: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

Sometimes you want to say something simply

and boldly on a dedicated slide. This template

is called the "quote".

10

Page 11: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

BLANK PAGE WITH A TITLE

11

Page 12: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

COLOR-PALETTE

12

#0078bf0,120,191

#00bccd0,188,205

#7dced5125,206,213

#00aa5b0,170,91

#85b880133,184,128

#bdbd32189,189,50

Safe on Projectors

#fff350255,243,80

Risky on Projectors

#fbe0ce251,224,206

#f2ba97242,186,151

#a17861161,120,97

#808184128,129,132

#eeeeee238,238,238

#ee5ba0238,91,160

#702269112,34,105

#b51b58181,27,88

#ed312f237,49,47

#f58a33245,138,51

#5f3c2595,60,37

Page 13: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

BOXES, SHAPES AND TABLES

PowerPoint doesn’t … offer much … in the way …

of custom … table … styles.

It prefers to use predefined colors from … The built in theme.

13

Shapes are tinted gray with lots of padding.

Works for any shape.

Buy default, a floating text box looks like this.

Page 14: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

CHARTS

14

Page 15: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

PARTING THOUGHTS (USING THE CHECKLIST TEMPLATE)

First, get the proper font: http://opensans.com/

Start with a clean template.

When in doubt, copy and paste from something that already works.

Be brave:

Learn to use master pages properly.

Edit! Brevity, not design, makes presentations great.

15

Page 16: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

DON’T MISS THE OTHER THEME COLORS

Check the themes tab for alternate colors

■ Black

■ Blue

■ Khaki

■ Orange

■ Green

■ Magenta

■ Pink

16

Page 17: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

THANK YOU

For questions or suggestions

Contact us via the Brand Hub:

https://my.thoughtworks.com/groups/brand

Page 18: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

AN INTRODUCTION TO NEUROEVOLUTION IN ERLANGJeroen Soeters

18

Page 19: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

ARTIFICIAL NEURAL NETWORKSThis is useful when you have a nice photo or color-block as a background. On this slide only, you can put your

elements behind a master element.

19

Page 20: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

HOW DOES YOUR BRAIN WORK?

Brain glyph, zooming in on neuron

Did you know demoting a line turns it into body copy like you see here. Then promoting

it again makes it a …

20

Page 21: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

MEET FRANK AND HIS PERCEPTRON

Frank Rosenblatt (1957)

Perceptron

Output = wi

21

Page 22: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

TRAINING A PERCEPTRON

Perceptron learning rule

wi(p + 1) = wi + a xi (p) e (p)

e(p) = Yd (p) – Y(p)

22

Page 23: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

TRAINING A PRECEPTRON

The and gate

0 0 0

0 1 0

1 0 0

1 1 1

23

Page 24: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

TRAINING A PRECEPTRON

Wtaf did that actually just do?

Graph

The perceptron is a linear classifier.

24

Page 25: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

LIMITATIONS OF THE PRECEPTRON

But what about an XOR gate?

Graph xor

25

Page 26: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

MULTILAYER PERCEPTRON

We need more layers

Image of DNN

26

Page 27: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

TRAINING A MULTILAYER PERCEPTRON

Back propagation algorithm

Based on a differentiable activation function, often sigmoid

27

Page 28: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

PROBLEMS WITH BACK PROPAGATION

■ You need a training set

■ Topology must be known in advance

■ Very computationally intensive

28

Page 29: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

29

Something on supervised vs unsupervised learning

Page 30: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

EVOLUTIONARY ALGORITHMSThis is useful when you have a nice photo or color-block as a background. On this slide only, you can put your

elements behind a master element.

30

Page 31: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

MEET JOHN AND HIS SCHEMA THEOREM

John Holland (1970s)

Schema theorem, looks more complicated than it is.

31

Page 32: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

EVOLUTIONARY ALGORITHM

■ Represent candidate solutions as chromosomes and determine fitness function

■ Create seed population

■ Calculate fitness for all members in population

■ Select parents based on fitness

■ Use mutation and crossover to create offspring

■ Repeat until some stop criterion is satisfied

32

Page 33: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

AN EXAMPLE: TRAVELLING SALESMAN

Cities.. Explain problem

33

Page 34: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

THE CHROMOSOME

ABCDEFGH

34

Page 35: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

THE FITNESS FUNCTION

1/ distance, want to maximize fitness

35

Page 36: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

SELECTION, MUTATION AND CROSSOVER

Easy…

36

Page 37: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

SELECTION, MUTATION AND CROSSOVER

Easy…

37

Page 38: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

TRY TO FIT IN AN EVOLUTIONARY PROGRAMMING SLIDE

Easy…

38

Page 39: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

NEUROEVOLUTIONWhat if we could evolve neural networks to an optimal topology with an optimal set of weights?

39

Page 40: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

MEET GENE AND HIS TWEANN/ TPEULN

Gene Sher (2011)

Deux Ex Neural Network

40

Page 41: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

TWEANN: KEY CHARACTERISTICS

Chromosome is represented as a graph

41

Page 42: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

TWEANN: KEY CHARACTERISTICS

Fitness function is performance of the NN on a real problem

42

Page 43: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

TWEANN: KEY CHARACTERISTICS

■ No crossover but RIM

■ It uses a memetic algorithm

● Competition algorithm for the topology search

● Stochastic hill climbing for weight tuning

43

Page 44: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

TWEANN: THE ALGORITHM

Create initial seed population

Start all agents, tune weights and find best fitness

When all agents finished

if ending condition not reached

calculate number of survivors

gather survivors based on effective fitness

run selection algorithm (competition)

start all agents, tune weights and find best fitness

44

Page 45: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

TWEANN: THE ALGORITHM

Calculate mutant allotment

Calculate normalizer

Calculate normalized mutant allotment

If Nallotment > 1 then

agent survives and creates Nallotment -1 mutant copiesI

Else if Nallotment = 1

agent survives but doesn’t create offspring

Else if Nallotment = 0

agent dies

45

Page 46: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

TWEANN: THE ALGORITHM

When agent finishes

if fitness > best fitness then

update best fitness

backup weights

attempts = 0

else

restore weights

attempts += 1

mutate weights

start agent

Until attempts > max attempts46

Page 47: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

MEET JOE AND HIS ERLANG

Joe Armstrong (1960)

Created Erlang

47

Page 48: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

WHY ERLANG?

1 on 1 mapping (Joe’s quote?)

48

Page 49: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

ERLANG IN TWO SLIDES

Basic code example

49

Page 50: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

MESSAGE PASSING EXAMPLE

Basic code example

50

Page 51: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

TWEANN: NEURONS

dot([I|Input],[W|Weights],Acc) ->

dot(Input,Weights,I*W+Acc);

dot([],[],Acc) ->

Acc.

51

(Id, ExoselfPid, CortexPid, AF, {[{Input_PId, Weights}|InputIdsPlusWeights], MInputIdsPlusWeights}, OutputPids, RecursiveOutp

receive

{Input_PId, forward, Input}

Result = dot(Input, Weights,

(Id, ExoselfPid, CortexPid, AF, {InputIdsPlusWeights, MInputIdsPlusWeights}, OutputPids, RecursiveOutputPids, Result

Page 52: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

TWEANN: SENSORS AND ACTUATORS

Sensors, actuators and code

52

Page 53: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

TWEANN: SCAPES

Scapes and code

53

Page 54: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

TWEANN: CORTEX

Cortex and code

54

Page 55: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

TWEANN: EXOSELF

Exoself and code

55

Page 56: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

TWEANN: POPULATION MONITOR

Population monitor and code

56

Page 57: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

CONNECTION ARCHITECTURE

Feed forward vs. recurrent

57

Page 58: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

HOW TO MAKE THIS WORK AT SCALE

Only tune the stuff that recently changed

Different types of sensor links

Neural plasticity

Substrate encoding

58

Page 59: A NICE BIG title - schd.wsschd.ws/hosted_files/buildstuff15lithuania/c7/neuroevolution... · NETWORKS This is useful when you have a nice photo or color-block as a background. ...

TWEANN: DEMO

XOR and pole balancing demo

59