Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PyCon UK 2016

Nikoleta
September 18, 2016

PyCon UK 2016

My talk on the Prisoners Dilemma and the Axelrod-Python library for PyCon UK 2016

Nikoleta

September 18, 2016
Tweet

More Decks by Nikoleta

Other Decks in Science

Transcript

  1. Prisoners, Cooperation and Spatial Structure The story of my MSc

    Dissertation N. Glynatsi @NikoletaGlyn https://github.com/Nikoleta-v3 PyCon UK, 2016
  2. 1 >>> import axelrod as axl 2 >>> players =

    [axl.Cooperator(), axl.Defector(), 3 ... axl.TitForTat(), axl.Grudger()] 4 >>> edges = [(0, 2), (0, 3), (1, 2), (1, 3)] 5 >>> spatial_tournament = axl.SpatialTournament(players, edges=edges) 6 >>> results = spatial_tournament.play(keep_interactions=True)
  3. 270 280 290 310 320 330 340 350 360 370

    380 390 400 410 420 430 440 450 460 470 570 Number of Participations 0.00 0.01 0.02 0.03 0.04 Winning Ratio Wining Ratio against Number of Partications for Cyclic Tournament Size 50 y= 0.000060775158539x+ 0.000060775158539 (p= 0.000060775158539)
  4. 0.0 0.2 0.4 0.6 0.8 1.0 Retaliate (0.05) Forgetful Fool

    Me Once Soft Go By Majority: 40 Cycler CCCD Anti Tit For Tat Punisher Inverse Win-Shift Lose-Stay ZD-GTFT-2 Adaptive Math Constant Hunter Cycler CCD Hard Go By Majority Win-Stay Lose-Shift SolutionB1 Calculator Eatherley Hard Prober Meta Majority Memory One Tricky Cooperator Grumpy Average Copier Hard Tit For Tat Meta Winner Long Memory Omega TFT Stochastic WSLS Soft Go By Majority: 20 Remorseful Prober: 0.1 Soft Grudger Meta Winner Finite Memory Meta Majority Long Memory Limited Retaliate (0.1/20) Limited Retaliate (0.08/15) Hard Tit For 2 Tats ZD-Extort-4 Cycler DDC Hesitant QLearner Meta Majority Finite Memory Contrite Tit For Tat Naive Prober: 0.1 Davis Meta Winner DoubleCrosser ALLCorALLD Limited Retaliate (0.05/20) Alternator Hunter Champion AntiCycler Adapative Pavlov 2006 Appeaser ZD-GEN-2 Joss: 0.9 ThueMorseInverse Tit For Tat Ripoff Once Bitten Risky QLearner Random: 0.5 Two Tits For Tat Cooperator Grudger Hard Go By Majority: 10 Defector Hunter Alternator Cycler DC Meta Majority Forgetful Grudger ZD-SET-2 Grofman Hard Go By Majority: 20 Cycle Hunter Forgiving Tit For Tat Tricky Defector Nydegger Sneaky Tit For Tat Prober Adapative Pavlov 2011 Cycler CCCCCD Hard Go By Majority: 5 Slow Tit For Two Tats ZD-Extort-2 EvolvedLookerUp Tit For 2 Tats Aggravater Meta Minority BackStabber ThueMorse Shubik Tullock Feld Arrogant QLearner Gradual Firm But Fair Handshake Defector Meta Winner Memory One Prober 2 Inverse Punisher Fool Me Once Fool Me Forever Soft Go By Majority Soft Go By Majority: 5 Cautious QLearner Forgiver Retaliate (0.1) Bully Prober 3 Meta Mixer Hard Go By Majority: 40 Suspicious Tit For Tat SolutionB5 GTFT: 0.33 PSO Gambler Opposite Grudger Meta Hunter ZD-Extort-2 v2 Predator Random Hunter Eventual Cycle Hunter Tester Retaliate (0.08) Fortress4 Cooperator Hunter Thumper Fortress3 Soft Joss: 0.9 Raider e Nice Average Copier Soft Go By Majority: 10 Cyclic Tournament Rankings Inverse Hard Tit For 2 Tats Meta Majority Long Memory Nydegger Thumper Ripoff Prober 3 Math Constant Hunter Grofman Fortress3 Eatherley Defector Naive Prober: 0.1 ThueMorse Contrite Tit For Tat Fool Me Forever ThueMorseInverse Tricky Cooperator Meta Majority Random Hunter Meta Mixer Stochastic WSLS Cooperator Hard Tit For Tat Predator Hard Go By Majority Arrogant QLearner Calculator Aggravater Random: 0.5 Fortress4 DoubleCrosser Cooperator Hunter Cycle Hunter Soft Go By Majority: 10 Retaliate (0.05) Grudger Hard Go By Majority: 10 Tester SolutionB1 Feld Limited Retaliate (0.1/20) Soft Go By Majority: 5 ZD-GEN-2 Retaliate (0.1) Alternator Eventual Cycle Hunter Anti Tit For Tat Forgiving Tit For Tat Adaptive Hesitant QLearner Hard Go By Majority: 20 Sneaky Tit For Tat Prober e Soft Grudger ZD-Extort-2 v2 Davis Win-Shift Lose-Stay ALLCorALLD Defector Hunter AntiCycler Prober 2 Suspicious Tit For Tat Gradual ZD-Extort-4 Handshake Average Copier Cycler CCD Soft Go By Majority: 20 ZD-GTFT-2 Soft Go By Majority Tricky Defector Risky QLearner Nice Average Copier Bully Cycler CCCD Adapative Pavlov 2011 Cycler CCCCCD Hard Go By Majority: 5 ZD-Extort-2 Firm But Fair Meta Hunter Two Tits For Tat Punisher Alternator Hunter Forgetful Fool Me Once GTFT: 0.33 Forgiver Meta Majority Finite Memory Opposite Grudger Hard Go By Majority: 40 Limited Retaliate (0.08/15) Win-Stay Lose-Shift Tullock Once Bitten Limited Retaliate (0.05/20) Retaliate (0.08) Hard Prober Tit For 2 Tats Soft Go By Majority: 40 Cycler DDC PSO Gambler BackStabber Meta Majority Memory One Shubik Meta Winner Finite Memory ZD-SET-2 Cycler DC Meta Winner Meta Minority Appeaser Soft Joss: 0.9 Tit For Tat SolutionB5 Joss: 0.9 Meta Winner Memory One Champion EvolvedLookerUp Omega TFT Meta Winner Long Memory Slow Tit For Two Tats Cautious QLearner Grumpy Forgetful Grudger Remorseful Prober: 0.1 Inverse Punisher Raider Fool Me Once Adapative Pavlov 2006 Periodic Lattice Tournament Rankings Player Rankings by Winning Ration in Cyclic vs Periodic Lattice Topologies size 50
  5. 0.0 0.2 0.4 0.6 0.8 1.0 Alternator Aggravater Handshake ThueMorse

    Hard Go By Majority: 20 Cycler CCCCCD Hard Go By Majority: 5 Defector Meta Minority Opposite Grudger Cycler DDC ZD-Extort-4 Remorseful Prober: 0.1 SolutionB1 Suspicious Tit For Tat Fortress3 Risky QLearner Predator Cycler CCCD Hard Go By Majority: 10 Arrogant QLearner Feld ZD-Extort-2 Average Copier Cycle Hunter ThueMorseInverse Cooperator Hunter Tullock Cycler CCD SolutionB5 Meta Mixer ALLCorALLD AntiCycler Prober 3 Ripoff Hard Go By Majority: 40 Hard Go By Majority Shubik Bully Tit For 2 Tats Fool Me Forever Defector Hunter Soft Go By Majority: 40 Tit For Tat Soft Go By Majority: 20 ZD-SET-2 Stochastic WSLS Hard Prober Tester Calculator Cautious QLearner Gradual Adapative Pavlov 2011 Inverse Punisher Prober 2 Soft Grudger ZD-Extort-2 v2 Adaptive Meta Majority Long Memory Cycler DC Limited Retaliate (0.05/20) Forgetful Grudger Tricky Defector Raider Appeaser Naive Prober: 0.1 Champion Nydegger Adapative Pavlov 2006 Meta Majority Memory One Punisher BackStabber Cooperator Alternator Hunter Win-Shift Lose-Stay Hesitant QLearner Soft Joss: 0.9 e Limited Retaliate (0.1/20) Soft Go By Majority Forgiving Tit For Tat Tricky Cooperator Prober Meta Majority Finite Memory Contrite Tit For Tat GTFT: 0.33 Anti Tit For Tat Random: 0.5 Fortress4 Sneaky Tit For Tat Joss: 0.9 Grumpy Slow Tit For Two Tats Hard Tit For Tat ZD-GTFT-2 Firm But Fair Once Bitten Inverse Retaliate (0.05) Fool Me Once Nice Average Copier Meta Winner Long Memory EvolvedLookerUp Meta Winner Forgiver Retaliate (0.1) Omega TFT Grudger Thumper DoubleCrosser Soft Go By Majority: 5 Grofman Math Constant Hunter Meta Winner Finite Memory ZD-GEN-2 Win-Stay Lose-Shift Random Hunter Limited Retaliate (0.08/15) Eventual Cycle Hunter Two Tits For Tat Retaliate (0.08) Eatherley Davis Meta Majority Soft Go By Majority: 10 PSO Gambler Meta Hunter Meta Winner Memory One Hard Tit For 2 Tats Forgetful Fool Me Once Cyclic Tournament Rankings Alternator Aggravater Handshake Hard Go By Majority: 20 ThueMorse Cycler CCCCCD Defector Hard Go By Majority: 5 Cycler DDC Opposite Grudger Meta Minority Remorseful Prober: 0.1 ZD-Extort-4 Cycler CCCD Risky QLearner Feld SolutionB1 Suspicious Tit For Tat Fortress3 Hard Go By Majority: 10 Arrogant QLearner Predator ZD-Extort-2 Average Copier Cycle Hunter Meta Mixer AntiCycler Cooperator Hunter ThueMorseInverse Bully Tullock Hard Go By Majority: 40 Prober 3 Defector Hunter Hard Go By Majority SolutionB5 ALLCorALLD Ripoff Shubik Fool Me Forever Cycler CCD Tit For 2 Tats Stochastic WSLS Soft Go By Majority: 40 Tester Tit For Tat Soft Go By Majority: 20 Hard Prober ZD-SET-2 Adaptive Cautious QLearner Soft Grudger Inverse Punisher Calculator Naive Prober: 0.1 Gradual Meta Majority Long Memory ZD-Extort-2 v2 Tricky Defector Adapative Pavlov 2011 Prober 2 Cycler DC Limited Retaliate (0.05/20) Champion Tricky Cooperator e Raider Appeaser Punisher Meta Majority Memory One Forgetful Grudger Win-Shift Lose-Stay Adapative Pavlov 2006 Cooperator BackStabber Nydegger Limited Retaliate (0.1/20) Soft Joss: 0.9 Random: 0.5 Hesitant QLearner Meta Majority Finite Memory Alternator Hunter Prober Contrite Tit For Tat Soft Go By Majority GTFT: 0.33 Fortress4 Forgiving Tit For Tat Grumpy ZD-GTFT-2 Once Bitten Joss: 0.9 Hard Tit For Tat Sneaky Tit For Tat Inverse Slow Tit For Two Tats Anti Tit For Tat Nice Average Copier Retaliate (0.05) Firm But Fair Fool Me Once EvolvedLookerUp Meta Winner Grudger Thumper Forgiver Grofman Meta Winner Long Memory Soft Go By Majority: 5 Omega TFT Math Constant Hunter Retaliate (0.1) DoubleCrosser ZD-GEN-2 Win-Stay Lose-Shift Meta Winner Finite Memory Random Hunter Limited Retaliate (0.08/15) Two Tits For Tat Eventual Cycle Hunter Eatherley Retaliate (0.08) Davis Meta Majority PSO Gambler Soft Go By Majority: 10 Meta Winner Memory One Meta Hunter Hard Tit For 2 Tats Forgetful Fool Me Once Periodic Lattice Tournament Rankings Player Rankings by Normalized Average Score in Cyclic vs Periodic Lattice Topologies size 50
  6. Limited Retaliate (0.1/20) Meta Minority Meta Majority Finite Memory SolutionB5

    Thumper Hard Go By Majority: 20 Grumpy Meta Majority Memory One Cycler CCCD Cooperator Hunter Tricky Defector Random: 0.5 Anti Tit For Tat Tricky Cooperator ALLCorALLD e Hard Go By Majority Hard Go By Majority: 40 Win­Shift Lose­Stay Hard Go By Majority: 5 Prober 2 SolutionB1 DoubleCrosser Cycler DC Handshake Retaliate (0.08) Meta Mixer Meta Majority Long Memory Random Hunter Remorseful Prober: 0.1 Adapative Pavlov 2011 Retaliate (0.05) Retaliate (0.1) Opposite Grudger Cycler CCCCCD Ripoff Davis Risky QLearner Inverse Punisher Soft Joss: 0.9 Suspicious Tit For Tat Predator Alternator Forgiver Limited Retaliate (0.05/20) Meta Winner Finite Memory GTFT: 0.33 Forgiving Tit For Tat Joss: 0.9 Prober Average Copier Naive Prober: 0.1 Tit For Tat Grofman Nice Average Copier Hard Tit For Tat Hard Go By Majority: 10 Punisher Forgetful Grudger Appeaser ZD­GTFT­2 Cycler CCD Meta Majority Tit For 2 Tats ThueMorseInverse Calculator EvolvedLookerUp Shubik Adapative Pavlov 2006 BackStabber Arrogant QLearner ZD­SET­2 ZD­Extort­2 v2 Feld Fool Me Once Hesitant QLearner Cooperator Tester Math Constant Hunter Tullock Meta Winner Long Memory Fortress3 Fortress4 Eventual Cycle Hunter Adaptive Limited Retaliate (0.08/15) Sneaky Tit For Tat Hard Prober Once Bitten Defector Inverse Hard Tit For 2 Tats Soft Go By Majority: 40 Alternator Hunter Soft Go By Majority: 10 ZD­Extort­2 Soft Go By Majority: 5 Raider Fool Me Forever Aggravater ThueMorse Defector Hunter Two Tits For Tat Soft Go By Majority: 20 AntiCycler Grudger Meta Winner Stochastic WSLS Soft Go By Majority Contrite Tit For Tat Omega TFT Cycle Hunter Soft Grudger Cycler DDC Meta Winner Memory One ZD­Extort­4 ZD­GEN­2 Firm But Fair Win­Stay Lose­Shift Bully Meta Hunter Champion Prober 3 Slow Tit For Two Tats Eatherley Forgetful Fool Me Once PSO Gambler Nydegger Cautious QLearner Gradual player_name 0.3 0.4 0.5 0.6 0.7 mean(normalized_rank) Median Normalized Rank for Second Generation Experiment
  7. Regression Results coefficient p value R squared Intercept 0.3712 0.000

    0.006 average.neighborhood.score 0.0206 0.000 - normalized.average.score -0.6150 0.001 - clustering 0.0033 0.033 - connectivity -0.0011 0.000 - cooperating.ratio -0.0403 0.000 - tournament.size 0.0033 0.000 - frequency 1.35e-06 0.000 - neighborhood.size 0.0005 0.017 -
  8. 0 50 100 150 200 250 generations 0.65 0.70 0.75

    0.80 0.85 0.90 0.95 median normalized rank Erd s Rényi Topology Median Rank for Entire Strategies Space Sample Size 15-50
  9. Achievements Unlocked Use my terminal Write efficient code Use various

    Python libraries Learn about TDD and version control systems