SlideShare a Scribd company logo
AI for Games Seminar 
by Andrea Tucci 
N-GRAM PREDICTION 
AND 
BAYES INFERENCE 
27/10/2014 
Slides by Andrea Tucci - @andreatux
OUTLINE 
➔ Context 
➔ Action Prediction 
◆ Techniques 
◆ N-Grams 
● Window Size 
◆ Considerations 
➔ Decision Learning 
OUTLINE 
◆ Techniques 
◆ Naive Bayes Classifiers 
◆ Bayes Networks 
● Bayes Inference 
● Probability Propagation 
● Games Application 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
OUTLINE 
OUTLINE - 2 
➔ Conclusion 
➔ Literature and Further Readings 
➔ Questions 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
OUTLINE 
● Learning in games 
Context 
○ more dynamism, basing on the player 
○ online and offline 
○ build a bot from user data/decision 
○ difficult to debug 
Uses 
● Parameter Modification 
● Action Prediction 
● Decisions 
● ...more 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
ACTION PREDICTION 
Action Prediction 
● Study the player’s behaviour, guess next move 
● Adaptive AI: the player cannot use the same 
technique 
● Same challenge, different experience 
● A little bit of randomness is needed… 
○ otherwise the player will predict the bot! 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
ACTION PREDICTION 
● Probability 
Techniques 
○ store data of the player’s choices 
○ pick the most predictable 
+ very easy to implement 
- the player can soon learn the mechanism 
● String Matching 
○ a string is used to store the player’s decisions 
○ to predict the next move, the string is parsed 
○ search for identical situation in the string 
○ prediction is based on history of choices 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
ACTION PREDICTION 
Example: 
Techniques - 2 
● In a RPG context the player can perform a physical 
attack and 3 spells: Fire, Blizzard, Thunder. 
○ Encoding: 
■ Physical Attack: “A” 
■ Fire : “F” 
■ Blizzard: “B” 
■ Thunder “T” 
● During a battle we store his/her decisions 
○ “AAFBAFBAATTFBBAAFB” 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
ACTION PREDICTION 
● Next move? 
Techniques - 3 
● Search in the string what the player did in the past, 
after performing a Fire spell followed by a Blizzard 
spell. 
● AAFBAFBAATTFBBAAFB (?) 
○ A physical attack is more predictable 
● Window size : how many moves should be looked up 
○ is 2 in the example above 
○ important for the performance of the prediction 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
ACTION PREDICTION 
N-Grams 
● Record the probabilities for each move given all 
combination of choices for the previous “N” 
moves.[Millington] 
● “N” = window size + 1 
○ 3-Gram keeps track the probabilities for a window 
size of 2 
● Update the list when new actions are performed 
● Predict the one with higher probability 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
ACTION PREDICTION 
N-Grams - 2 
Example: Left or Right? 
LRRLLLRLLRLRL..(?) 
3-Gram predictor 
->R ->L 
LL 2/3 1/3 
LR 1/4 3/4 
RL 1/3 2/3 
RR 0/1 1/1 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
ACTION PREDICTION 
N-Grams - 3 
Easy to predict things like... 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
ACTION PREDICTION 
N-Grams - Window Size 
● Determine the accuracy of the prediction 
● Increasing the window size means better prediction 
○ ...until it get worse 
● Optimal window size should not be too large 
○ Long sequences tend to have too much randomness 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
ACTION PREDICTION 
N-Grams - Window Size 
Accuracy of N-Grams for the Left-Right game.[Millington] 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
ACTION PREDICTION 
Considerations 
● The more the window increase in size, the more memory 
is required to store probabilities 
● Best performance are achieved when sequences are 
“known” 
○ otherwise learning takes a while… 
● Very suitable for combat games, computational linguistics, 
computational biology and in general pattern-based 
actions 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
DECISION LEARNING 
Decision Learning 
● Learn how to make decisions 
● From a set of possible actions, AI learn which one apply 
basing on observation data 
● Weak and strong supervision 
○ give feedback to the AI choices 
● Huge amount of information in games 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
DECISION LEARNING 
Techniques 
● Decision Tree Learning 
● Artificial Neural Networks 
● Naive Bayes Classifiers 
● Reinforcement Learning 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
DECISION LEARNING 
Naive Bayes Classifiers 
● Decide an action from previous observation 
○ can be other players decisions, in the same context 
● Basing on evidence, gives the probability of “how good” is 
executing an action 
● Bayes rule 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
DECISION LEARNING 
Naive Bayes Classifiers - 2 
● Core concept: express the conditional probability of A 
given B, in terms of its inverse, B given A. 
○ the probability that it rained can be expressed as the 
observation that the ground is wet 
Example: in a soccer game, should we shoot at goal? 
● Base our decision on a training set 
● Try to find decision patterns 
● Data in the example is labeled 
○ this help to generalise similar context 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
DECISION LEARNING 
Naive Bayes Classifiers - Example 
Shoot? Distance Direction Markers 
Yes Medium Central Low 
Yes Large Central None 
No Short Central High 
No Large Angular High 
Yes Short Angular None 
No Medium Angular High 
Yes Medium Central Medium 
No Short Central High 
Yes Medium Angular Low 
[...] [...] [...] [...] 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
DECISION LEARNING 
Naive Bayes Classifiers - Example ctd. 
Should we shoot if... 
○ distance = medium 
○ direction = angular 
○ markers = none 
P ( shoot? | dist, dir, mark) = P(shoot? | dist) * P(shoot? | dir) * 
P(shoot? | mark) 
● Applying the bayes rule, we have an indication based on 
the data collected 
○ Google Docs 
● Player should shoot! 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
DECISION LEARNING 
Bayes Networks 
● Reason under uncertainty 
○ AI reasons in a human like way, no cheats 
● Arrange variables and their relationship in a “belief network” 
○ acyclic graph 
○ variables are encoded as node 
○ relationships are arcs 
○ variable probability distribution encoded in a table 
● Inference using probabilistic reasoning 
○ Causal Inference: given A → B, we know A 
○ Diagnostic Inference: given A → B, we know B 
○ Intercausal Inference: given A → C and B → C, we know C 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
DECISION LEARNING 
Bayes Networks - 2 
Away from home, our neighborhood tell us that he heard our 
alarm rang.. What happened? 
● P(A) = P(B) * P(E) * P(A|B,E) 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
DECISION LEARNING 
Bayes Inference 
P(B) P(E) P(A|B,E) P(A) N. P(A) 
T=.001 T=.002 .95 .000002 .000795 
T=.001 F=.998 .94 .000938 .372814 
F=.999 T=.002 .29 .000579 .230127 
F=.999 F=.998 0.001 .000997 .396264 
.002516 1 
● If the news inform us on an earthquake… the probability 
that a burglary occurred as well, are low! 
○ B → A, E → A. P(E) changed and P(B) changed as 
well 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
DECISION LEARNING 
Bayes Inference - 2 
Determining the probability of a burglary after the news 
P(B) P(E) P(A|B,E) P(A) N. P(A) 
T=.001 T=1 .95 .00095 .003269 
T=.001 F=0 .94 0 0 
F=.999 T=1 .29 .28971 .996731 
F=.999 F=0 .001 0 0 
.29066 1 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
DECISION LEARNING 
Bayes Inference - 3 
● Find the probability distribution over a variable X given the evidence e 
○ P(X | e) ? 
● Inference can be exact or approximated 
● Computing the probability of a node: summing the probabilities of the 
parent nodes 
○ chain rule 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
DECISION LEARNING 
Probability Propagation 
● The belief of each node is updated by prior or posterior 
evidence updates 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
DECISION LEARNING 
● Visibility 
Bayes Networks in 
○ “fog of war” 
● Dependency graphs 
games 
○ RTS technology graph 
■ infer existence of some technologies by the 
presence of others 
■ which dependencies a player is attaining 
■ etc 
● Detect Intruder 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
DECISION LEARNING 
Conclusion 
● Learning can be used for many reasons in game 
development 
● Main question.. do we need it? 
○ balance effort of building a learning system with 
outcomes 
● Offline learning is often preferred 
● Learning a whole new behaviour is not so easy 
● Adaptive AI can be the future of gaming 
○ ideally no repetitive challenges 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
DECISION LEARNING 
Literature and Further Readings 
● Artificial Intelligence for Games [Ian Millington, John Funge] 
● AI Games Programming Wisdom [Steve Rabin] 
● Teaching Bayesian behaviours to video game characters [Ronan Le 
Hy, et al] 
● MIT open courseware 
● PR-OWL 
● Bayesian Networks [Judea Pearl, Stuart Russell] 
● Design and Development of a Compound DSS for Laboratory 
Research [Tomáš Hujer] 
● Bayesian Artificial Intelligence [Kevin B. Korb, Ann E. Nicholson] 
● Player Prediction techniques for AI in video games [Michael 
Webersdorfer] 
● Adaptive AI for fighting games [Ricciardi, Thill 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
CONCLUSION 
That’s it! 
Thank you for your 
attention 
Questions? 
N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux

More Related Content

PPT
Frustration of Contracts and Force Majeure clauses
PDF
Scrum survey sprint planning
PPTX
PDF
Project Pitch: Answer Set Programming for Procedural Content Generation
PDF
Shop 2 presentation slide
PDF
Htn in videogames
KEY
Artificial Intelligence in Computer and Video Games
PPT
Artificial intelligence In Modern-Games.
Frustration of Contracts and Force Majeure clauses
Scrum survey sprint planning
Project Pitch: Answer Set Programming for Procedural Content Generation
Shop 2 presentation slide
Htn in videogames
Artificial Intelligence in Computer and Video Games
Artificial intelligence In Modern-Games.

Viewers also liked (18)

PDF
Artificial intelligence in gaming.
PPT
Game Playing in Artificial Intelligence
PPT
Artificial Intelligence
DOCX
Game Paper
PPT
A* Path Finding
PPT
Artificial Intelligence (and Stupidity) in the Game Industry
PPTX
Micropinion Generation
PDF
MEIS 2015 : A Multilayered Model for Artificial Intelligence of Game Characte...
PPT
6 games
PPTX
Artificial intelligence and video games
PPTX
Artificial Intelligence in Gaming
PDF
Why Artificial Intelligence is a Game Changer for Retail Data
PDF
Artificial Intelligence in games
PPT
Amit ppt
PPT
Bfs and dfs in data structure
PPTX
Game playing in artificial intelligent technique
PDF
AI Uninformed Search Strategies by Examples
PPTX
Adversarial search
Artificial intelligence in gaming.
Game Playing in Artificial Intelligence
Artificial Intelligence
Game Paper
A* Path Finding
Artificial Intelligence (and Stupidity) in the Game Industry
Micropinion Generation
MEIS 2015 : A Multilayered Model for Artificial Intelligence of Game Characte...
6 games
Artificial intelligence and video games
Artificial Intelligence in Gaming
Why Artificial Intelligence is a Game Changer for Retail Data
Artificial Intelligence in games
Amit ppt
Bfs and dfs in data structure
Game playing in artificial intelligent technique
AI Uninformed Search Strategies by Examples
Adversarial search
Ad

Similar to Ai for games seminar: N-Grams prediction + intro to bayes inference (20)

PDF
Bayesian networks
PPTX
recent.pptx
PDF
Probabilistic Programming: Why, What, How, When?
PDF
Machine Learning: Learning with data
PDF
One talk Machine Learning
PPT
AML_030607.ppt
PPT
NaiveBayes classifier for data classification
PPT
NaiveBayesfcctcvtyvyuyuvuygygygiughuobiubivvyjnh
PPT
This is a heavily data-oriented
PPT
This is a heavily data-oriented
PPT
Anticipation Mappings for Learning Classifier Systems
PPT
Anticipation Mappings for Learning Classifier Systems
PPT
NaiveBayes this is more functioonal and extraction of same version
PDF
Individual Project - Final Report
PPT
NaiveBayes.ppt
PPT
NaiveBayes.ppt
PPT
NaiveBayes.ppt Naive Bayes algorithm machine learning
PPT
NaiveBayes.ppt
PPTX
1.1 Probability Theory and Naiv Bayse.pptx
PDF
Bayes 6
Bayesian networks
recent.pptx
Probabilistic Programming: Why, What, How, When?
Machine Learning: Learning with data
One talk Machine Learning
AML_030607.ppt
NaiveBayes classifier for data classification
NaiveBayesfcctcvtyvyuyuvuygygygiughuobiubivvyjnh
This is a heavily data-oriented
This is a heavily data-oriented
Anticipation Mappings for Learning Classifier Systems
Anticipation Mappings for Learning Classifier Systems
NaiveBayes this is more functioonal and extraction of same version
Individual Project - Final Report
NaiveBayes.ppt
NaiveBayes.ppt
NaiveBayes.ppt Naive Bayes algorithm machine learning
NaiveBayes.ppt
1.1 Probability Theory and Naiv Bayse.pptx
Bayes 6
Ad

Recently uploaded (20)

PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Electronic commerce courselecture one. Pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Big Data Technologies - Introduction.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
KodekX | Application Modernization Development
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Machine learning based COVID-19 study performance prediction
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
A Presentation on Artificial Intelligence
“AI and Expert System Decision Support & Business Intelligence Systems”
Chapter 3 Spatial Domain Image Processing.pdf
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Electronic commerce courselecture one. Pdf
The AUB Centre for AI in Media Proposal.docx
Understanding_Digital_Forensics_Presentation.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Reach Out and Touch Someone: Haptics and Empathic Computing
Big Data Technologies - Introduction.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
20250228 LYD VKU AI Blended-Learning.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
KodekX | Application Modernization Development
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Mobile App Security Testing_ A Comprehensive Guide.pdf
Machine learning based COVID-19 study performance prediction
MYSQL Presentation for SQL database connectivity
A Presentation on Artificial Intelligence

Ai for games seminar: N-Grams prediction + intro to bayes inference

  • 1. AI for Games Seminar by Andrea Tucci N-GRAM PREDICTION AND BAYES INFERENCE 27/10/2014 Slides by Andrea Tucci - @andreatux
  • 2. OUTLINE ➔ Context ➔ Action Prediction ◆ Techniques ◆ N-Grams ● Window Size ◆ Considerations ➔ Decision Learning OUTLINE ◆ Techniques ◆ Naive Bayes Classifiers ◆ Bayes Networks ● Bayes Inference ● Probability Propagation ● Games Application N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
  • 3. OUTLINE OUTLINE - 2 ➔ Conclusion ➔ Literature and Further Readings ➔ Questions N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
  • 4. OUTLINE ● Learning in games Context ○ more dynamism, basing on the player ○ online and offline ○ build a bot from user data/decision ○ difficult to debug Uses ● Parameter Modification ● Action Prediction ● Decisions ● ...more N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
  • 5. ACTION PREDICTION Action Prediction ● Study the player’s behaviour, guess next move ● Adaptive AI: the player cannot use the same technique ● Same challenge, different experience ● A little bit of randomness is needed… ○ otherwise the player will predict the bot! N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
  • 6. ACTION PREDICTION ● Probability Techniques ○ store data of the player’s choices ○ pick the most predictable + very easy to implement - the player can soon learn the mechanism ● String Matching ○ a string is used to store the player’s decisions ○ to predict the next move, the string is parsed ○ search for identical situation in the string ○ prediction is based on history of choices N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
  • 7. ACTION PREDICTION Example: Techniques - 2 ● In a RPG context the player can perform a physical attack and 3 spells: Fire, Blizzard, Thunder. ○ Encoding: ■ Physical Attack: “A” ■ Fire : “F” ■ Blizzard: “B” ■ Thunder “T” ● During a battle we store his/her decisions ○ “AAFBAFBAATTFBBAAFB” N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
  • 8. ACTION PREDICTION ● Next move? Techniques - 3 ● Search in the string what the player did in the past, after performing a Fire spell followed by a Blizzard spell. ● AAFBAFBAATTFBBAAFB (?) ○ A physical attack is more predictable ● Window size : how many moves should be looked up ○ is 2 in the example above ○ important for the performance of the prediction N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
  • 9. ACTION PREDICTION N-Grams ● Record the probabilities for each move given all combination of choices for the previous “N” moves.[Millington] ● “N” = window size + 1 ○ 3-Gram keeps track the probabilities for a window size of 2 ● Update the list when new actions are performed ● Predict the one with higher probability N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
  • 10. ACTION PREDICTION N-Grams - 2 Example: Left or Right? LRRLLLRLLRLRL..(?) 3-Gram predictor ->R ->L LL 2/3 1/3 LR 1/4 3/4 RL 1/3 2/3 RR 0/1 1/1 N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
  • 11. ACTION PREDICTION N-Grams - 3 Easy to predict things like... N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
  • 12. ACTION PREDICTION N-Grams - Window Size ● Determine the accuracy of the prediction ● Increasing the window size means better prediction ○ ...until it get worse ● Optimal window size should not be too large ○ Long sequences tend to have too much randomness N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
  • 13. ACTION PREDICTION N-Grams - Window Size Accuracy of N-Grams for the Left-Right game.[Millington] N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
  • 14. ACTION PREDICTION Considerations ● The more the window increase in size, the more memory is required to store probabilities ● Best performance are achieved when sequences are “known” ○ otherwise learning takes a while… ● Very suitable for combat games, computational linguistics, computational biology and in general pattern-based actions N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
  • 15. DECISION LEARNING Decision Learning ● Learn how to make decisions ● From a set of possible actions, AI learn which one apply basing on observation data ● Weak and strong supervision ○ give feedback to the AI choices ● Huge amount of information in games N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
  • 16. DECISION LEARNING Techniques ● Decision Tree Learning ● Artificial Neural Networks ● Naive Bayes Classifiers ● Reinforcement Learning N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
  • 17. DECISION LEARNING Naive Bayes Classifiers ● Decide an action from previous observation ○ can be other players decisions, in the same context ● Basing on evidence, gives the probability of “how good” is executing an action ● Bayes rule N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
  • 18. DECISION LEARNING Naive Bayes Classifiers - 2 ● Core concept: express the conditional probability of A given B, in terms of its inverse, B given A. ○ the probability that it rained can be expressed as the observation that the ground is wet Example: in a soccer game, should we shoot at goal? ● Base our decision on a training set ● Try to find decision patterns ● Data in the example is labeled ○ this help to generalise similar context N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
  • 19. DECISION LEARNING Naive Bayes Classifiers - Example Shoot? Distance Direction Markers Yes Medium Central Low Yes Large Central None No Short Central High No Large Angular High Yes Short Angular None No Medium Angular High Yes Medium Central Medium No Short Central High Yes Medium Angular Low [...] [...] [...] [...] N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
  • 20. DECISION LEARNING Naive Bayes Classifiers - Example ctd. Should we shoot if... ○ distance = medium ○ direction = angular ○ markers = none P ( shoot? | dist, dir, mark) = P(shoot? | dist) * P(shoot? | dir) * P(shoot? | mark) ● Applying the bayes rule, we have an indication based on the data collected ○ Google Docs ● Player should shoot! N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
  • 21. DECISION LEARNING Bayes Networks ● Reason under uncertainty ○ AI reasons in a human like way, no cheats ● Arrange variables and their relationship in a “belief network” ○ acyclic graph ○ variables are encoded as node ○ relationships are arcs ○ variable probability distribution encoded in a table ● Inference using probabilistic reasoning ○ Causal Inference: given A → B, we know A ○ Diagnostic Inference: given A → B, we know B ○ Intercausal Inference: given A → C and B → C, we know C N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
  • 22. DECISION LEARNING Bayes Networks - 2 Away from home, our neighborhood tell us that he heard our alarm rang.. What happened? ● P(A) = P(B) * P(E) * P(A|B,E) N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
  • 23. DECISION LEARNING Bayes Inference P(B) P(E) P(A|B,E) P(A) N. P(A) T=.001 T=.002 .95 .000002 .000795 T=.001 F=.998 .94 .000938 .372814 F=.999 T=.002 .29 .000579 .230127 F=.999 F=.998 0.001 .000997 .396264 .002516 1 ● If the news inform us on an earthquake… the probability that a burglary occurred as well, are low! ○ B → A, E → A. P(E) changed and P(B) changed as well N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
  • 24. DECISION LEARNING Bayes Inference - 2 Determining the probability of a burglary after the news P(B) P(E) P(A|B,E) P(A) N. P(A) T=.001 T=1 .95 .00095 .003269 T=.001 F=0 .94 0 0 F=.999 T=1 .29 .28971 .996731 F=.999 F=0 .001 0 0 .29066 1 N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
  • 25. DECISION LEARNING Bayes Inference - 3 ● Find the probability distribution over a variable X given the evidence e ○ P(X | e) ? ● Inference can be exact or approximated ● Computing the probability of a node: summing the probabilities of the parent nodes ○ chain rule N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
  • 26. DECISION LEARNING Probability Propagation ● The belief of each node is updated by prior or posterior evidence updates N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
  • 27. DECISION LEARNING ● Visibility Bayes Networks in ○ “fog of war” ● Dependency graphs games ○ RTS technology graph ■ infer existence of some technologies by the presence of others ■ which dependencies a player is attaining ■ etc ● Detect Intruder N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
  • 28. DECISION LEARNING Conclusion ● Learning can be used for many reasons in game development ● Main question.. do we need it? ○ balance effort of building a learning system with outcomes ● Offline learning is often preferred ● Learning a whole new behaviour is not so easy ● Adaptive AI can be the future of gaming ○ ideally no repetitive challenges N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
  • 29. DECISION LEARNING Literature and Further Readings ● Artificial Intelligence for Games [Ian Millington, John Funge] ● AI Games Programming Wisdom [Steve Rabin] ● Teaching Bayesian behaviours to video game characters [Ronan Le Hy, et al] ● MIT open courseware ● PR-OWL ● Bayesian Networks [Judea Pearl, Stuart Russell] ● Design and Development of a Compound DSS for Laboratory Research [Tomáš Hujer] ● Bayesian Artificial Intelligence [Kevin B. Korb, Ann E. Nicholson] ● Player Prediction techniques for AI in video games [Michael Webersdorfer] ● Adaptive AI for fighting games [Ricciardi, Thill N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux
  • 30. CONCLUSION That’s it! Thank you for your attention Questions? N-gram Prediction and Bayes Inference • Andrea Tucci - @andreatux