30
ARC 2012 SOCIETY OF ACTUARIES Genetic Algorithms – 4-AUG-2012 Dave Snell Dave Snell, ASA, MAAA, CLU, ChFC, FLMI, MCP, ARA, ACS Technology Evangelist, Vice Chairman’s Office RGA Reinsurance Company Genetic Algorithms: Genetic Algorithm Applications to Actuarial Problems

Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

ARC 2012

S O C I E T Y O F A C T U A R I E S Genetic Algorithms – 4-AUG-2012 Dave Snell

Dave Snell, ASA, MAAA, CLU, ChFC, FLMI, MCP, ARA, ACS Technology Evangelist, Vice Chairman’s Office RGA Reinsurance Company

Genetic Algorithms: Genetic Algorithm Applications to Actuarial Problems

Page 2: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

They mimic our current knowledge of genetics. We have trillions of cells. DNA represents a blueprint for a cell. It is used to generate copies. The actual process involves proteins and lots of other biological terms …

Genetic Algorithms – 4-AUG-2012 Dave Snell

Why do we call these Genetic Algorithms?

Page 3: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

Over time - a long time - we evolve … taller, less hairy, and more adept at making tools.

Mitosis – exact copies Meiosis – copy portions from two parents Mutation – inexact copy – rarely lives

Genetic Algorithms – 4-AUG-2012 Dave Snell

Page 4: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

Very basic genetics

§  Humans have about 25,000 genes made from A-T and C-G pairs

§  DNA strand – double helix of two strands – each about 1.8 meters

§  In meiosis, the strand separates into 46 chromosomes (in 23 pairs)

§  Alleles (forms of a gene) help determine physical or behavioral traits

Genetic Algorithms – 4-AUG-2012 Dave Snell

Page 5: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

§  Human 3,200,000,000 (3.2Gb)

§  Lungfish130,000,000,000 (130Gb)

§  "Amoeba" 670,000,000,000 (670Gb)

Does the size of a Genome determine species dominance? NO! – It’s all in how you use it!

Genetic Algorithms – 4-AUG-2012 Dave Snell

Page 6: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

National Institutes of Health (NIH)

Where is the Research being done on Genomes? All over the world; but especially …

The Genome Institute at Washington University

Genetic Algorithms – 4-AUG-2012 Dave Snell

“This is why I go to work!” RMS – rhabdomyosarcoma -Frederick S. Huang, MD

Page 7: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

Genetic Algorithms Meet Amoeba Robby

Story of Robby simplified from Complexity: A Guided Tour by Melanie Mitchell, Ph.D.

Robby is only able to do 7 actions: 0-Move North 1 square 1-Move South 1 square 2-Move West1 square 3-Move East 1 square 4-Stay put 5-Pick up a can 6-Make random move (from 0-5)

Our first Robby is blind!

Genetic Algorithms – 4-AUG-2012 Dave Snell

Page 8: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

Genetic Algorithms (cont.)

§  Robby actions can be represented by a strategy string, like ‘35265’

(move East, pickup, move South, random, pickup)

§  In 100 steps, what strategy would you use to pick up as many randomly placed cans as possible? You get 10 points for each can.

0- north 1 1- south 1 2- west 1 3- east 1 4-Stay put 5-Pick up 6-random

Genetic Algorithms – 4-AUG-2012 Dave Snell

Page 9: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

Genetic Algorithms (cont.)

§  Robby actions can be represented by a strategy string, like ‘35265’

(move East, pickup, move South, random, pickup) §  In 100 steps, what strategy would you use to pick

up as many randomly placed cans as possible? You get 10 points for each can.

• Oh yeah! … you lose 5 points every time you hit a wall.

0- north 1 1- south 1 2- west 1 3- east 1 4-Stay put 5-Pick up 6-random

Genetic Algorithms – 4-AUG-2012 Dave Snell

Page 10: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

Genetic Algorithms – 4-AUG-2012 Dave Snell

7^100 > 10^84 so trying all possibilities might take too long

… compare to around 10^17 seconds since Big Bang billions of years ago

Try all possibilities?

Page 11: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

Hill Climbing … works really well when there is only one hill

Genetic Algorithms – 4-AUG-2012 Dave Snell Yak, yak, yak

Mount Everest?

Our family in Tibet

Page 12: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

2.  Run 100 tests with cans scattered randomly. 3.  Score each robot and eliminate losers

(survival of the fittest). 4.  Assign mating privileges to survivors per

test scores.

Genetic Algorithms (a simplistic recipe)

1.  Randomly assign the gene string for 100 robots.

Genetic Algorithms – 4-AUG-2012 Dave Snell

In a kangaroo mob, only the highest ranking male

gets mating privileges

Page 13: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

Genetic Algorithms (simplistic recipe continued.)

Parent M (52.80 points): 54335351253404 315142153601520652551511513145155663 Parent F (45.60 points) :54335351525534 633242153604216362551511503145155625

arbitrary (pseudo-random) split point

Child A: 54335351253404 633242153604216362551511503145155625

Child B: 54335351525534 315142153601520652551511513145155663

5.  Pick parents, and pair them off to produce the next generation

Genetic Algorithms – 4-AUG-2012 Dave Snell

genes from parent F genes from parent M

Page 14: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

Genetic Algorithms (simplistic recipe wrap-up.)

1.  Randomly assign the initial gene strings. 2.  Run tests. 3.  Score each robot and eliminate losers. 4.  Assign mating privileges to highest scorers. 5.  Pick parents, and produce next generation. 6.  Randomly mutate a few genes (actions). 7.  Repeat for 100 (or 1,000 or 10,000) generations.

Genetic Algorithms – 4-AUG-2012 Dave Snell

Page 15: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

Demonstration: Blind Robby

Genetic Algorithms – 4-AUG-2012 Dave Snell

Watch evolution in action

Page 16: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

Genetic Algorithms (How twins are made)

Genetic Algorithms – 4-AUG-2012 Dave Snell

Page 17: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

Let’s give Robby a sense of Vision

Robby can see five squares: the current square. the square immediately to the East the square immediately to the South the square immediately to the West the square immediately to the North

Assume each of these five squares can have three different states: 0 = Empty; 1= Contains a can; 2 = Wall

The total number of visual cases is (3 states/cell) ^(5 visible cells) = 243

Genetic Algorithms – 4-AUG-2012 Dave Snell

Page 18: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

Robby with Vision (continued)

Genetic Algorithms – 4-AUG-2012 Dave Snell

Let’s number these 243 cases from 0 to 242

3^4 3^3 3^2 3^1 3^0North West South East Current Case

0 0 0 0 0 00 0 0 0 1 10 0 0 0 2 20 0 0 1 0 3

…2 2 2 2 1 2412 2 2 2 2 242

Robby is in a wall (not possible)

It doesn’t matter that some of the cases are not physically possible. Our case table mathematics is not limited by the possible!

other impossible cases

Generation 1 will have a randomly generated column of actions. Future generations inherit actions from parents.

Case Action0 MoveNorth1 PickUpCan2 MoveSouth3 MoveNorth

241 MoveEast242 MoveWest

Page 19: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

‘Suppose we want the action for this situation:

Genetic Algorithms – 4-AUG-2012 Dave Snell

Robby with Vision (continued)

Robby sees a wall to the East and cans to the North and South.

Page 20: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

CASE TABLECase Number Current East South West North Action

0 0 0 0 0 0 MoveEast1 0 0 0 0 1 MoveEast

… …96 0 2 1 0 1 MoveNorth

… …242 2 2 2 2 2 PickUpCan

For this particular ‘gene string’, case number 96 results in action MoveNorth. Note: The actions for any particular gene string do not have to make sense! Only the better ones survive and propagate.

Genetic Algorithms – 4-AUG-2012 Dave Snell

This would correspond to case number 96 in the virtual case table, calculated as follows: 0*3^0 (current) + 2*3^1 (East) + 1*3^2 (South)

+ 0*3^3 (West) + 1*3^4 (North) = 0+6+9+0+81 = 96

Robby with Vision (continued)

Page 21: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

Demonstration: Robby with vision

Genetic Algorithms – 4-AUG-2012 Dave Snell

Watch evolution in action

Page 22: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

Mitosis & Meiosis

Our Elites correspond to Mitosis

The rest of the new generation are analogous to Meiosis

Genetic Algorithms – 4-AUG-2012 Dave Snell

Page 23: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

Gene

1 Dad Mom Dad Mom Dad's Dad Mom's Dad Dad's Mom Mom's Mom Dad's Dad Mom's Mom Dad's Mom Mom's Dad

2 Dad Mom Dad Mom Dad's Mom Mom's Mom Dad's Mom Mom's Dad Dad's Mom Mom's Mom Dad's Mom Mom's Dad

3 Dad Mom Dad Mom Dad's Dad Mom's Mom Dad's Mom Mom's Mom Dad's Mom Mom's Mom Dad's Mom Mom's Dad

4 Dad Mom Dad Mom Dad's Dad Mom's Dad Dad's Dad Mom's Mom Dad's Mom Mom's Mom Dad's Mom Mom's Mom

…5,000 Dad Mom Dad Mom Dad's Mom Mom's Mom Dad's Dad Mom's Mom Dad's Dad Mom's Mom Dad's Mom Mom's Mom

5001 Dad Mom Dad Mom Dad's Mom Mom's Dad Dad's Mom Mom's Dad Dad's Mom Mom's Dad Dad's Dad Mom's Dad…

Parent  'M' Parent  'F' Child1 Child2 Child3 Child4

Meiosis in action - Genetics 0.001

Genetic Algorithms – 4-AUG-2012 Dave Snell

Note that each child gene is from two of the four grandparents: one on Mom’s side, one on Dad’s side

(excluding mutations)

Parent genes prior to meiosis – each person gets one set from Dad and another set from Mom

set of genes from Dad

set of genes from Mom

Page 24: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

Genetic Algorithms are not limited to two parents (or even four grandparents)

Your ‘genes’ can have vastly different characteristics and components.

A ‘child’ can have genes drawn from several different parents.

Genetic Algorithms – 4-AUG-2012 Dave Snell

Page 25: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

That was fun! … but let’s see a Health Insurance application of Genetic Algorithms.

Brian Grossmiller’s application: How to find a more cost effective set of health providers and still have adequate coverage.

Genetic Algorithms – 4-AUG-2012 Dave Snell

Page 26: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

Gene$c  Algorithms  –  4-­‐AUG-­‐2012  Dave  Snell    

Demonstration: Health Provider Network

Page 27: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

But does it work?

§ Overall Network Relativity: 1.00

§ Actuaries (using standard optimization techniques): 0.72

§ Genetic Algorithm: 0.54

(lower number is better … a lot lower is a lot better) Genetic Algorithms – 4-AUG-2012 Dave Snell

Page 28: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

Basics to take home with you §  Keep problem manageable

§  Define objective §  Robby - clean world §  Provider Network - lower health costs and adequate coverage

§  Define universe for the actors §  Robby - 10x10 grid littered with soda cans §  Provider Network - all available providers, their specialties, their relative costs

§  Define actions – how actors change the universe §  Blind Robby – deterministic gene string with 7 possible actions for each gene §  Robby with vision – adapts to environment and chooses actions (from 7) §  Provider network – deterministic gene string, simple IN or OUT of network

§  Create evaluation/ranking scheme (points for cans, or relative cost) §  Make a reproductive model

§  Blind Robby and Robby with Vision – 2 parents and a crossover point §  Provider network - N parents and pseudo-random selection gene-by-gene

§  Validate (save entire gene string for best set and verify it works) Genetic Algorithms – 4-AUG-2012 Dave Snell

Page 29: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

Wrap-up, and Feedback

Good tools and Fun? …

… or did we waste your time?

Let’s Talk!

Most actuarial presentations are like mathematics, 1/2 the people can’t understand them …

and the other 2/3 don’t care about them

S O C I E T Y O F A C T U A R I E S

Bonus video 1 - Robby

Bonus video 2- EC gain

Bonus video 3 – EC strategy

Genetic Algorithms – 4-AUG-2012 Dave Snell

Page 30: Genetic Algorithms: Genetic Algorithm Applications to Actuarial … · 2020-01-09 · ARC 2012 Genetic Algorithms – 4-AUG-2012 Dave Snell SOCIETY OF ACTUARIES Dave Snell, ASA, MAAA,

ARC 2012

S O C I E T Y O F A C T U A R I E S Genetic Algorithms – 4-AUG-2012 Dave Snell

Dave Snell, ASA, MAAA, CLU, ChFC, FLMI, MCP, ARA, ACS Technology Evangelist, Vice Chairman’s Office RGA Reinsurance Company

Genetic Algorithms: Genetic Algorithm Applications to Actuarial Problems