際際滷

際際滷Share a Scribd company logo
Machine Learning for Gamers
Dungeon Forecasts and Dragon Regressions
Who is this Guy?
Guy Royse
Developer Evangelist
Nexosis
guy@nexosis.com
@guyroyse
2
Who is this Company?
3
Nexosis is a company of
developers focused on
providing easy access to
machine learning.
4
IANADS
5
6
What is Machine Learning?
7
Gather
Data
Build a
Model
Make
Predictions
8
Gather
Data
Target
Features
Encoding
Imputation
Build a
Model
Make
Predictions
Target & Features
Target
The thing we want to
predict
Features
Things that a鍖ect the thing
we want to predict
9
Encoding & Imputation
10
Encoding
Converting non-numeric data to
numeric data
Imputation
Replacing nulls in the data with
meaningful replacements
11
Encoding
Gobliniod
Yes
No
Goblinoid
1
0
Color
Black
Blue
Green
Red
White
Black Blue Green Red White
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
Boolean Encoding
One-Hot Encoding
12
Gather
Data
Build a
Model
Algorithm
Train
Test
Make
Predictions
Algorithms
13
 ARIMA
 Various combinations of
 AutoRegressive component
with p parameters
 Di鍖erencing component with
d parameters
 Moving Average component
with qparameters
 with external regressors
 Exponential Smoothing
 Simple
 Double
 Triple
 with Box-Cox Transformation
 Autoregressive Neural Network
 with or without external
regressors
 Multiple Linear Regression
 with or without external
regressors
 Spline
 Seasonal and Trend
Decomposition using Loess
 with ARIMA
 with or without external
regressors
 with Exponential Smoothing
 Bayesian Time Series Regression
 with or without external
regressors
 Additive Model
 Home-grown Nexosis Algorithms
 Least Squares
 Linear
 Polynomial
 Elastic Net
 Lasso
 Ridge
 Support Vector Regression
 Linear Kernel
 Polynomial Kernel
 Radial Basis Function kernel
 Sigmoid Kernel
 Multi-Layer Perceptron (Neural
Network)
 with 1, 2, or 3 hidden layers
 Recti鍖ed Linear Unit
Function
 Hyperbolic Tan Function
 Sigmoid Function
 Random Forest
 K-Nearest Neighbor
 Logistic Regression
 Naive Bayes
14
Train & Test
467 366 832 915 27 499 217 693 659 506 411
645 677 50 514 251 198 792 398 418 781 297
77 124 406 967 728 295 344 483 332 983 734
949 270 891 509 426 880 163 67 407 63 227
713 152 2 247 956 530 407 442 103 558 36
762 727 79 172 50 810 389 374 607 215 386
7 927 906 119 743 480 577 226 160 395 635
745 117 391 753 570 106 366 470 228 771 524
973 136 844 334 922 332 297 129 17 154 41
198 862 773 165 679 241 742 731 603 366 866
872 20 891 742 933 578 59 723 758 785 153
336 84 829 851 210 144 140 747 306 214 121
15
Gather
Data
Build a
Model
Algorithm
Train
Test
Make
Predictions
16
Gather
Data
Build a
Model
Make
Predictions
Provide Features
Get Target
17
Regression
Classification
Anomaly Detection
Forecasting
Impact Analysis
18
Regression
Determine the value of a dragons hoard in gold pieces based on the age, color, and hit points of that dragon.
19
About Dragons
Wyrmling
Young
Adult
Ancient
Black
Blue
Green
Red
White
Brass
Bronze
Copper
Gold
Silver
How much
damage the
dragon can take
until defeated
Total value of all
the dragons
treasure in gold
pieces
Age Color Hit Points Hoard Value
20
Training Data
Age Color Hit Points Hoard Value
Young Gold 178 3,419.31
Ancient Blue 481 105,630.42
Ancient Green 385 107,355.23
Wyrmling Green 38 233.15
Adult Red 256 152,685.62
Adult Brass 172 4,490.94
Young Silver 168 2,786.95
Wyrmling Copper 22 155.11
Young Black 127 5,345.34
Adult White 200 3,789.23
Wyrmling Bronze 32 556.12
Ancient Bronze 444 123,891.74
Adult White 223 10,345.45
21
Asking the Question
Age Color Hit Points Hoard Value
Ancient Gold 527 ?
Age Color Hit Points Hoard Value
Ancient Gold ? 129,459.14
22
Can I Ask This?
Age Color Hit Points Hoard Value
Ancient ? 527 129,459.14
Age Color Hit Points Hoard Value
? Gold 527 129,459.14
23
Classification
Based on the six key abilities and race of a character, determine what class they should play.
24
About Characters
Strength
Dexterity
Constitution
Intelligence
Wisdom
Charisma
Elf
Dwarf
Halfling
Human
Gnome
Half-Elf
Half-Orc
Tiefling
Barbarian
Bard
Cleric
Druid
Fighter
Monk
Paladin
Ranger
Rogue
Sorcerer
Warlock
Wizard
Abilities Race Class
Dragonborn
25
Training Data
Str Dex Con Int Wis Cha Race Class
14 13 15 11 9 15 Half-Orc Barbarian
8 12 15 13 11 12 Half-Elf Rogue
12 10 15 16 5 10 Elf Wizard
17 17 17 10 7 18 Dwarf Fighter
15 15 14 11 11 13 Human Fighter
13 8 14 5 12 17 Halfing Bard
18 16 15 13 9 15 Halfling Rogue
10 10 15 12 15 16 Tiefling Warlock
18 11 10 12 12 11 Dwarf Fighter
16 5 9 8 16 16 Human Paladin
16 14 11 13 13 15 Dragonborn Fighter
5 9 14 9 11 13 Human Bard
10 12 7 15 15 10 Gnome Cleric
26
Asking the Question
Str Dex Con Int Wis Cha Race Class
14 13 15 11 9 15 Half-Orc ?
Barbarian 0.97184
Bard 0.83836
Cleric 0.81324
Druid 0.76682
Fighter 0.76646
Monk 0.64012
Paladin 0.5957
Ranger 0.5273
Rogue 0.44096
Sorcerer 0.27116
Warlock 0.18702
Wizard 0.07035
27
Asking the Question
Str Dex Con Int Wis Cha Race Class
14 13 15 11 9 15 ? Cleric
Dwarf 0.97184
Elf 0.83836
Halfling 0.81324
Human 0.76682
Dragonborn 0.76646
Gnome 0.64012
Half-Elf 0.27116
Half-Orc 0.18702
Tiefling 0.07035
28
Anomaly Detection
Based on the six key abilities, race, and class of a character, determine if that character is playable or not.
29
Training Data
Str Dex Con Int Wis Cha Race Class
14 13 15 11 9 15 Half-Orc Barbarian
8 12 15 13 11 12 Half-Elf Rogue
12 10 15 16 5 10 Elf Wizard
17 17 17 10 7 18 Dwarf Fighter
3 15 14 11 11 13 Human Fighter
13 8 14 5 12 17 Halfing Bard
18 16 15 13 9 15 Halfling Rogue
10 10 15 12 15 16 Tiefling Warlock
18 11 10 12 12 11 Dwarf Fighter
16 5 9 8 16 16 Human Paladin
16 14 11 13 13 15 Dragonborn Fighter
5 9 14 9 11 3 Human Bard
10 12 7 15 15 10 Gnome Cleric
30
Training Data
Str Dex Con Int Wis Cha Race Class Playability
14 13 15 11 9 15 Half-Orc Barbarian 0.18
8 12 15 13 11 12 Half-Elf Rogue 0.06
12 10 15 16 5 10 Elf Wizard 0
17 17 17 10 7 18 Dwarf Fighter 0.36
3 15 14 11 11 13 Human Fighter -0.02
13 8 14 5 12 17 Halfing Bard 0.02
18 16 15 13 9 15 Halfling Rogue 0.36
10 10 15 12 15 16 Tiefling Warlock 0.2
18 11 10 12 12 11 Dwarf Fighter 0.12
16 5 9 8 16 16 Human Paladin 0.04
16 14 11 13 13 15 Dragonborn Fighter 0.28
5 9 14 9 11 3 Human Bard -0.34
10 12 7 15 15 10 Gnome Cleric 0.02
Str Dex Con Int Wis Cha Race Class Playability
16 14 16 6 9 4 Half-Orc Barbarian ?
8 8 8 18 16 10 Half-Orc Barbarian ?
31
Asking the Question
32
Forecasting
Predict the number of encounters that will be completed per weekly session for future weeks based on which players will be present
and how long the session will last.
33
About Gaming Sessions
When the
session
occurred
The players
who attended
the game for
that particular
session
Time spent
playing during
that particular
game session
Number of
completed
combats for the
session
Date Players Length Encounters
34
Training Data
Date Alice Bob Chuck Eve Length Encounters
11/13/2016 Yes Yes Yes Yes 4.00 4
11/20/2016 Yes No Yes Yes 4.50 4
11/27/2016 Yes Yes Yes Yes 3.25 3
12/4/2016 Yes Yes Yes Yes 5.50 6
12/11/2016 Yes Yes Yes No 12.00 8
12/18/2016 Yes No No Yes 4.00 7
12/25/2016 No No No No 0.00 0
1/1/2017 No No Yes Yes 4.50 3
1/8/2017 Yes Yes Yes Yes 7.00 5
1/15/2017 Yes Yes Yes Yes 6.25 7
1/22/2017 Yes Yes No Yes 6.00 8
1/29/2017 Yes Yes Yes No 4.00 4
2/5/2017 Yes Yes Yes Yes 3.75 3
Date Alice Bob Chuck Eve Length Encounters
2/12/2017 Yes Yes Yes Yes ? 4
2/19/2017 Yes Yes Yes Yes ? 5
2/26/2017 Yes Yes Yes No ? 4
Date Alice Bob Chuck Eve Length Encounters
2/12/2017 Yes Yes Yes Yes 4.00 ?
2/19/2017 Yes Yes Yes Yes 4.00 ?
2/26/2017 Yes Yes Yes No 6.00 ?
35
Asking the Question
36
Impact Analysis
Measure the impact of updating your campaign from Pathfinder to 5th Edition.
37
Training Data
Date Alice Bob Chuck Eve Length Encounters
11/13/2016 Yes Yes Yes Yes 4.00 4
11/20/2016 Yes No Yes Yes 4.50 4
11/27/2016 Yes Yes Yes Yes 3.25 3
12/4/2016 Yes Yes Yes Yes 5.50 6
12/11/2016 Yes Yes Yes No 12.00 8
12/18/2016 Yes No No Yes 4.00 7
12/25/2016 No No No No 0.00 0
1/1/2017 No No Yes Yes 4.50 3
1/8/2017 Yes Yes Yes Yes 7.00 5
1/15/2017 Yes Yes Yes Yes 6.25 7
1/22/2017 Yes Yes No Yes 6.00 8
1/29/2017 Yes Yes Yes No 4.00 4
2/5/2017 Yes Yes Yes Yes 3.75 3
Date Alice Bob Chuck Eve Length Encounters
1/1/2017 No No Yes Yes 4.50 3
1/8/2017 Yes Yes Yes Yes 7.00 5
1/15/2017 Yes Yes Yes Yes 6.25 7
1/22/2017 Yes Yes No Yes 6.00 8
1/29/2017 Yes Yes Yes No 4.00 4
2/5/2017 Yes Yes Yes Yes 3.75 3
38
Asking the Question
Date Alice Bob Chuck Eve Length Encounters
1/1/2017 No No Yes Yes 4.50 ?
1/8/2017 Yes Yes Yes Yes 7.00 ?
1/15/2017 Yes Yes Yes Yes 6.25 ?
1/22/2017 Yes Yes No Yes 6.00 ?
1/29/2017 Yes Yes Yes No 4.00 ?
2/5/2017 Yes Yes Yes Yes 3.75 ?
39
Asking the Question
Date Actual Encoutners Predicted Encounters Change
1/1/2017 3 5.0346 2.0346
1/8/2017 5 8.391 3.391
1/15/2017 7 11.7474 4.7474
1/22/2017 8 13.4256 5.4256
1/29/2017 4 6.7128 2.7128
2/5/2017 3 5.0346 2.0346
40
Regression
Classification
Anomaly Detection
Forecasting
Impact Analysis
41
Questions?
Who is this Guy?
Guy Royse
Developer Evangelist
Nexosis
guy@nexosis.com
@guyroyse
42
43
Credits
o Images
o https://www.flickr.com/photos/t17emma/5909350021
o https://www.flickr.com/photos/rueink/35095791331
o https://www.flickr.com/photos/rueink/37125691160
o https://www.flickr.com/photos/fauxlaroid/5988373053
o https://www.flickr.com/photos/kimonomania/602858091
o https://www.flickr.com/photos/wonderferret/174314534
o https://www.flickr.com/photos/herval/4100847043
Machine Learning for Gamers - Dungeon Forecasts & Dragon Regressions

More Related Content

Machine Learning for Gamers - Dungeon Forecasts & Dragon Regressions

  • 1. Machine Learning for Gamers Dungeon Forecasts and Dragon Regressions
  • 2. Who is this Guy? Guy Royse Developer Evangelist Nexosis guy@nexosis.com @guyroyse 2
  • 3. Who is this Company? 3 Nexosis is a company of developers focused on providing easy access to machine learning.
  • 5. 5
  • 6. 6 What is Machine Learning?
  • 9. Target & Features Target The thing we want to predict Features Things that a鍖ect the thing we want to predict 9
  • 10. Encoding & Imputation 10 Encoding Converting non-numeric data to numeric data Imputation Replacing nulls in the data with meaningful replacements
  • 11. 11 Encoding Gobliniod Yes No Goblinoid 1 0 Color Black Blue Green Red White Black Blue Green Red White 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 Boolean Encoding One-Hot Encoding
  • 13. Algorithms 13 ARIMA Various combinations of AutoRegressive component with p parameters Di鍖erencing component with d parameters Moving Average component with qparameters with external regressors Exponential Smoothing Simple Double Triple with Box-Cox Transformation Autoregressive Neural Network with or without external regressors Multiple Linear Regression with or without external regressors Spline Seasonal and Trend Decomposition using Loess with ARIMA with or without external regressors with Exponential Smoothing Bayesian Time Series Regression with or without external regressors Additive Model Home-grown Nexosis Algorithms Least Squares Linear Polynomial Elastic Net Lasso Ridge Support Vector Regression Linear Kernel Polynomial Kernel Radial Basis Function kernel Sigmoid Kernel Multi-Layer Perceptron (Neural Network) with 1, 2, or 3 hidden layers Recti鍖ed Linear Unit Function Hyperbolic Tan Function Sigmoid Function Random Forest K-Nearest Neighbor Logistic Regression Naive Bayes
  • 14. 14 Train & Test 467 366 832 915 27 499 217 693 659 506 411 645 677 50 514 251 198 792 398 418 781 297 77 124 406 967 728 295 344 483 332 983 734 949 270 891 509 426 880 163 67 407 63 227 713 152 2 247 956 530 407 442 103 558 36 762 727 79 172 50 810 389 374 607 215 386 7 927 906 119 743 480 577 226 160 395 635 745 117 391 753 570 106 366 470 228 771 524 973 136 844 334 922 332 297 129 17 154 41 198 862 773 165 679 241 742 731 603 366 866 872 20 891 742 933 578 59 723 758 785 153 336 84 829 851 210 144 140 747 306 214 121
  • 18. 18 Regression Determine the value of a dragons hoard in gold pieces based on the age, color, and hit points of that dragon.
  • 19. 19 About Dragons Wyrmling Young Adult Ancient Black Blue Green Red White Brass Bronze Copper Gold Silver How much damage the dragon can take until defeated Total value of all the dragons treasure in gold pieces Age Color Hit Points Hoard Value
  • 20. 20 Training Data Age Color Hit Points Hoard Value Young Gold 178 3,419.31 Ancient Blue 481 105,630.42 Ancient Green 385 107,355.23 Wyrmling Green 38 233.15 Adult Red 256 152,685.62 Adult Brass 172 4,490.94 Young Silver 168 2,786.95 Wyrmling Copper 22 155.11 Young Black 127 5,345.34 Adult White 200 3,789.23 Wyrmling Bronze 32 556.12 Ancient Bronze 444 123,891.74 Adult White 223 10,345.45
  • 21. 21 Asking the Question Age Color Hit Points Hoard Value Ancient Gold 527 ? Age Color Hit Points Hoard Value Ancient Gold ? 129,459.14
  • 22. 22 Can I Ask This? Age Color Hit Points Hoard Value Ancient ? 527 129,459.14 Age Color Hit Points Hoard Value ? Gold 527 129,459.14
  • 23. 23 Classification Based on the six key abilities and race of a character, determine what class they should play.
  • 25. 25 Training Data Str Dex Con Int Wis Cha Race Class 14 13 15 11 9 15 Half-Orc Barbarian 8 12 15 13 11 12 Half-Elf Rogue 12 10 15 16 5 10 Elf Wizard 17 17 17 10 7 18 Dwarf Fighter 15 15 14 11 11 13 Human Fighter 13 8 14 5 12 17 Halfing Bard 18 16 15 13 9 15 Halfling Rogue 10 10 15 12 15 16 Tiefling Warlock 18 11 10 12 12 11 Dwarf Fighter 16 5 9 8 16 16 Human Paladin 16 14 11 13 13 15 Dragonborn Fighter 5 9 14 9 11 13 Human Bard 10 12 7 15 15 10 Gnome Cleric
  • 26. 26 Asking the Question Str Dex Con Int Wis Cha Race Class 14 13 15 11 9 15 Half-Orc ? Barbarian 0.97184 Bard 0.83836 Cleric 0.81324 Druid 0.76682 Fighter 0.76646 Monk 0.64012 Paladin 0.5957 Ranger 0.5273 Rogue 0.44096 Sorcerer 0.27116 Warlock 0.18702 Wizard 0.07035
  • 27. 27 Asking the Question Str Dex Con Int Wis Cha Race Class 14 13 15 11 9 15 ? Cleric Dwarf 0.97184 Elf 0.83836 Halfling 0.81324 Human 0.76682 Dragonborn 0.76646 Gnome 0.64012 Half-Elf 0.27116 Half-Orc 0.18702 Tiefling 0.07035
  • 28. 28 Anomaly Detection Based on the six key abilities, race, and class of a character, determine if that character is playable or not.
  • 29. 29 Training Data Str Dex Con Int Wis Cha Race Class 14 13 15 11 9 15 Half-Orc Barbarian 8 12 15 13 11 12 Half-Elf Rogue 12 10 15 16 5 10 Elf Wizard 17 17 17 10 7 18 Dwarf Fighter 3 15 14 11 11 13 Human Fighter 13 8 14 5 12 17 Halfing Bard 18 16 15 13 9 15 Halfling Rogue 10 10 15 12 15 16 Tiefling Warlock 18 11 10 12 12 11 Dwarf Fighter 16 5 9 8 16 16 Human Paladin 16 14 11 13 13 15 Dragonborn Fighter 5 9 14 9 11 3 Human Bard 10 12 7 15 15 10 Gnome Cleric
  • 30. 30 Training Data Str Dex Con Int Wis Cha Race Class Playability 14 13 15 11 9 15 Half-Orc Barbarian 0.18 8 12 15 13 11 12 Half-Elf Rogue 0.06 12 10 15 16 5 10 Elf Wizard 0 17 17 17 10 7 18 Dwarf Fighter 0.36 3 15 14 11 11 13 Human Fighter -0.02 13 8 14 5 12 17 Halfing Bard 0.02 18 16 15 13 9 15 Halfling Rogue 0.36 10 10 15 12 15 16 Tiefling Warlock 0.2 18 11 10 12 12 11 Dwarf Fighter 0.12 16 5 9 8 16 16 Human Paladin 0.04 16 14 11 13 13 15 Dragonborn Fighter 0.28 5 9 14 9 11 3 Human Bard -0.34 10 12 7 15 15 10 Gnome Cleric 0.02
  • 31. Str Dex Con Int Wis Cha Race Class Playability 16 14 16 6 9 4 Half-Orc Barbarian ? 8 8 8 18 16 10 Half-Orc Barbarian ? 31 Asking the Question
  • 32. 32 Forecasting Predict the number of encounters that will be completed per weekly session for future weeks based on which players will be present and how long the session will last.
  • 33. 33 About Gaming Sessions When the session occurred The players who attended the game for that particular session Time spent playing during that particular game session Number of completed combats for the session Date Players Length Encounters
  • 34. 34 Training Data Date Alice Bob Chuck Eve Length Encounters 11/13/2016 Yes Yes Yes Yes 4.00 4 11/20/2016 Yes No Yes Yes 4.50 4 11/27/2016 Yes Yes Yes Yes 3.25 3 12/4/2016 Yes Yes Yes Yes 5.50 6 12/11/2016 Yes Yes Yes No 12.00 8 12/18/2016 Yes No No Yes 4.00 7 12/25/2016 No No No No 0.00 0 1/1/2017 No No Yes Yes 4.50 3 1/8/2017 Yes Yes Yes Yes 7.00 5 1/15/2017 Yes Yes Yes Yes 6.25 7 1/22/2017 Yes Yes No Yes 6.00 8 1/29/2017 Yes Yes Yes No 4.00 4 2/5/2017 Yes Yes Yes Yes 3.75 3
  • 35. Date Alice Bob Chuck Eve Length Encounters 2/12/2017 Yes Yes Yes Yes ? 4 2/19/2017 Yes Yes Yes Yes ? 5 2/26/2017 Yes Yes Yes No ? 4 Date Alice Bob Chuck Eve Length Encounters 2/12/2017 Yes Yes Yes Yes 4.00 ? 2/19/2017 Yes Yes Yes Yes 4.00 ? 2/26/2017 Yes Yes Yes No 6.00 ? 35 Asking the Question
  • 36. 36 Impact Analysis Measure the impact of updating your campaign from Pathfinder to 5th Edition.
  • 37. 37 Training Data Date Alice Bob Chuck Eve Length Encounters 11/13/2016 Yes Yes Yes Yes 4.00 4 11/20/2016 Yes No Yes Yes 4.50 4 11/27/2016 Yes Yes Yes Yes 3.25 3 12/4/2016 Yes Yes Yes Yes 5.50 6 12/11/2016 Yes Yes Yes No 12.00 8 12/18/2016 Yes No No Yes 4.00 7 12/25/2016 No No No No 0.00 0 1/1/2017 No No Yes Yes 4.50 3 1/8/2017 Yes Yes Yes Yes 7.00 5 1/15/2017 Yes Yes Yes Yes 6.25 7 1/22/2017 Yes Yes No Yes 6.00 8 1/29/2017 Yes Yes Yes No 4.00 4 2/5/2017 Yes Yes Yes Yes 3.75 3
  • 38. Date Alice Bob Chuck Eve Length Encounters 1/1/2017 No No Yes Yes 4.50 3 1/8/2017 Yes Yes Yes Yes 7.00 5 1/15/2017 Yes Yes Yes Yes 6.25 7 1/22/2017 Yes Yes No Yes 6.00 8 1/29/2017 Yes Yes Yes No 4.00 4 2/5/2017 Yes Yes Yes Yes 3.75 3 38 Asking the Question Date Alice Bob Chuck Eve Length Encounters 1/1/2017 No No Yes Yes 4.50 ? 1/8/2017 Yes Yes Yes Yes 7.00 ? 1/15/2017 Yes Yes Yes Yes 6.25 ? 1/22/2017 Yes Yes No Yes 6.00 ? 1/29/2017 Yes Yes Yes No 4.00 ? 2/5/2017 Yes Yes Yes Yes 3.75 ?
  • 39. 39 Asking the Question Date Actual Encoutners Predicted Encounters Change 1/1/2017 3 5.0346 2.0346 1/8/2017 5 8.391 3.391 1/15/2017 7 11.7474 4.7474 1/22/2017 8 13.4256 5.4256 1/29/2017 4 6.7128 2.7128 2/5/2017 3 5.0346 2.0346
  • 42. Who is this Guy? Guy Royse Developer Evangelist Nexosis guy@nexosis.com @guyroyse 42
  • 43. 43 Credits o Images o https://www.flickr.com/photos/t17emma/5909350021 o https://www.flickr.com/photos/rueink/35095791331 o https://www.flickr.com/photos/rueink/37125691160 o https://www.flickr.com/photos/fauxlaroid/5988373053 o https://www.flickr.com/photos/kimonomania/602858091 o https://www.flickr.com/photos/wonderferret/174314534 o https://www.flickr.com/photos/herval/4100847043