SlideShare a Scribd company logo
1 of 22
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
WHAT IS A MARKOV CHAIN?
UNDERSTANDING MARKOV CHAINS WITH AN EXAMPLE
MARKOV CHAIN IN PYTHON
MARKOV CHAIN APPLICATIONS
TRANSITION MATRIX & TRANSISTION STATE DIAGRAM
www.edureka.co
WHAT IS A MARKOV CHAIN?
www.edureka.co
A stochastic process containing random variables, transitioning from one state to another
depending on certain assumptions and definite probabilistic rules.
What Is A Markov chain?
Markov Property states that the calculated probability of a random process transitioning to the
next possible state is only dependent on the current state and time and it is independent of the
series of states that preceded it.
Let the random process be, { 𝑋 𝑚 , m=0,1,2 … }
This process is a Markov chain only if,
𝑃 𝑋 𝑚+1 = ȁ𝑗 𝑋 𝑚 = ⅈ, 𝑋 𝑚−1 = ⅈ 𝑚−1, … , 𝑋0 = ⅈ0 = 𝑃 𝑋 𝑚+1 = ȁ𝑗 𝑋 𝑚 = ⅈ
𝑃𝑖𝑗 = 𝑃 𝑋 𝑚+1 = ȁ𝑗 𝑋 𝑚 = ⅈ
www.edureka.co
UNDERSTANDING MARKOV CHAINS
www.edureka.co
A Markov Model is a stochastic model that models random variables in such a manner that the variables
follow the Markov property.
• Keys denote the unique words in the sentence, i.e., 5 keys (one, two, hail, happy, edureka)
• Tokens denote the total number of words, i.e. 8 tokens.
one edureka two edureka hail edureka happy edureka
www.edureka.co
A Markov Model is a stochastic model that models random variables in such a manner that the variables
follow the Markov property.
one
edureka
two
hail
happy
1
4
1
1
1
Keys Frequencies
www.edureka.co
A Markov Model is a stochastic model that models random variables in such a manner that the variables
follow the Markov property.
one
edureka
two
hail
happy
1
4
1
1
1
Weighted distributions:
1. 'edureka' is 50% (4/8)
2. (one, two, hail, happy)
is ≈ 13% (1/8)
www.edureka.co
Start one edureka two edureka hail edureka happy edureka end
one
edureka
two
hail
happy
1
4
1
1
1
start
end
1
1
Keys Frequencies
www.edureka.co
(Start, one)
(one, edureka)
(edureka, two)
(two, edureka)
(edureka, hail)
(hail, edureka)
(edureka, happy)
(happy, edureka)
(edureka, end)
(end, none)
(Start, one)
(one, edureka)
(edureka, two) (edureka, hail) (edureka, happy) (edureka, end)
(two, edureka)
(hail, edureka)
(happy, edureka)
(end, none)
www.edureka.co
(Start, one)
(one, edureka)
(edureka, two) (edureka, hail) (edureka, happy) (edureka, end)
(two, edureka)
(hail, edureka)
(happy, edureka)
(end, none)
Start [one]
One [edureka]
Edureka [two, hail, happy, end]
Two [edureka]
Hail [edureka]
Happy [edureka]
End [none]
www.edureka.co
Start
One
hailtwo
happy
end
edureka
1
1
1
1
1
1/4
1/4
1/4
1/4
Start [one]
One [edureka]
Edureka [two, hail, happy, end]
Two [edureka]
Hail [edureka]
Happy [edureka]
End [none]
www.edureka.co
TRANSITION MATRIX & STATE DAIGRAM
www.edureka.co
In a Markov Process, we use a matrix to represent the transition probabilities from one state to
another. This matrix is called the Transition or probability matrix. It is usually denoted by P.
What Is A Transition Matrix?
𝑝11 𝑝12 𝑝1𝑟
𝑝21 𝑝22 𝑝2𝑟
𝑝21 𝑝22 𝑝2𝑟
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
P =
෍
𝑘=1
𝑟
𝑝𝑖𝑘 = ෍
𝑘=1
𝑟
𝑃 𝑋 𝑚+1 = ȁ𝑘 𝑋 𝑚 = ⅈ
Note, 𝑝ij ≥ 0, and 'i' for all values is,
www.edureka.co
Consider a Markov chain with three states 1, 2, and 3.
Transition Matrix & State Diagram Example
Transition matrix
1/4 0 3/4
P = 1/2 0 1/2
1/4 1/2 1/4
1 2
3
1/4
3/4
1/2
1/2
1/4
1/2
1/4
State Transition Diagram
www.edureka.co
DEMO
www.edureka.co
To apply Markov Property and create a Markov Model that can generate text simulations by
studying Donald Trump speech data set.
Problem Statement
Apply Markov property
Generate Text Simulations
Donald Trump speeches
www.edureka.co
MARKOV CHAIN APPLICATIONS
www.edureka.co
Markov Chain Applications
Google PageRank Autocomplete
www.edureka.co
Markov Chain Applications
Subreddit simulator Text generator
www.edureka.co
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
www.edureka.co
www.edureka.co

More Related Content

What's hot

Markov Chain Monte Carlo Methods
Markov Chain Monte Carlo MethodsMarkov Chain Monte Carlo Methods
Markov Chain Monte Carlo MethodsFrancesco Casalegno
 
Propositional And First-Order Logic
Propositional And First-Order LogicPropositional And First-Order Logic
Propositional And First-Order Logicankush_kumar
 
From logistic regression to linear chain CRF
From logistic regression to linear chain CRFFrom logistic regression to linear chain CRF
From logistic regression to linear chain CRFDarren Yow-Bang Wang
 
Forms of learning in ai
Forms of learning in aiForms of learning in ai
Forms of learning in aiRobert Antony
 
Information and network security 35 the chinese remainder theorem
Information and network security 35 the chinese remainder theoremInformation and network security 35 the chinese remainder theorem
Information and network security 35 the chinese remainder theoremVaibhav Khanna
 
Daa:Dynamic Programing
Daa:Dynamic ProgramingDaa:Dynamic Programing
Daa:Dynamic Programingrupali_2bonde
 
Hidden Markov Model - The Most Probable Path
Hidden Markov Model - The Most Probable PathHidden Markov Model - The Most Probable Path
Hidden Markov Model - The Most Probable PathLê Hòa
 
First Order Predicate Logic Examples| Different Examples
First Order Predicate Logic Examples| Different ExamplesFirst Order Predicate Logic Examples| Different Examples
First Order Predicate Logic Examples| Different ExamplesHabibaSaeed5
 
Pseudo Random Number Generators
Pseudo Random Number GeneratorsPseudo Random Number Generators
Pseudo Random Number GeneratorsDarshini Parikh
 
Newton’s Divided Difference Formula
Newton’s Divided Difference FormulaNewton’s Divided Difference Formula
Newton’s Divided Difference FormulaJas Singh Bhasin
 
2.5 ambiguity in context free grammars
2.5 ambiguity in context free grammars2.5 ambiguity in context free grammars
2.5 ambiguity in context free grammarsSampath Kumar S
 
Variational Autoencoder Tutorial
Variational Autoencoder Tutorial Variational Autoencoder Tutorial
Variational Autoencoder Tutorial Hojin Yang
 
Decision tree, softmax regression and ensemble methods in machine learning
Decision tree, softmax regression and ensemble methods in machine learningDecision tree, softmax regression and ensemble methods in machine learning
Decision tree, softmax regression and ensemble methods in machine learningAbhishek Vijayvargia
 

What's hot (20)

Markov chains1
Markov chains1Markov chains1
Markov chains1
 
Markov Chain Monte Carlo Methods
Markov Chain Monte Carlo MethodsMarkov Chain Monte Carlo Methods
Markov Chain Monte Carlo Methods
 
Propositional And First-Order Logic
Propositional And First-Order LogicPropositional And First-Order Logic
Propositional And First-Order Logic
 
From logistic regression to linear chain CRF
From logistic regression to linear chain CRFFrom logistic regression to linear chain CRF
From logistic regression to linear chain CRF
 
Markov chain
Markov chainMarkov chain
Markov chain
 
Forms of learning in ai
Forms of learning in aiForms of learning in ai
Forms of learning in ai
 
2.2.ppt.SC
2.2.ppt.SC2.2.ppt.SC
2.2.ppt.SC
 
Information and network security 35 the chinese remainder theorem
Information and network security 35 the chinese remainder theoremInformation and network security 35 the chinese remainder theorem
Information and network security 35 the chinese remainder theorem
 
Daa:Dynamic Programing
Daa:Dynamic ProgramingDaa:Dynamic Programing
Daa:Dynamic Programing
 
Aes
AesAes
Aes
 
Hidden Markov Model - The Most Probable Path
Hidden Markov Model - The Most Probable PathHidden Markov Model - The Most Probable Path
Hidden Markov Model - The Most Probable Path
 
First Order Predicate Logic Examples| Different Examples
First Order Predicate Logic Examples| Different ExamplesFirst Order Predicate Logic Examples| Different Examples
First Order Predicate Logic Examples| Different Examples
 
Pseudo Random Number Generators
Pseudo Random Number GeneratorsPseudo Random Number Generators
Pseudo Random Number Generators
 
Theory of Computation Unit 2
Theory of Computation Unit 2Theory of Computation Unit 2
Theory of Computation Unit 2
 
Perceptron & Neural Networks
Perceptron & Neural NetworksPerceptron & Neural Networks
Perceptron & Neural Networks
 
Newton’s Divided Difference Formula
Newton’s Divided Difference FormulaNewton’s Divided Difference Formula
Newton’s Divided Difference Formula
 
Theory of Computation Unit 3
Theory of Computation Unit 3Theory of Computation Unit 3
Theory of Computation Unit 3
 
2.5 ambiguity in context free grammars
2.5 ambiguity in context free grammars2.5 ambiguity in context free grammars
2.5 ambiguity in context free grammars
 
Variational Autoencoder Tutorial
Variational Autoencoder Tutorial Variational Autoencoder Tutorial
Variational Autoencoder Tutorial
 
Decision tree, softmax regression and ensemble methods in machine learning
Decision tree, softmax regression and ensemble methods in machine learningDecision tree, softmax regression and ensemble methods in machine learning
Decision tree, softmax regression and ensemble methods in machine learning
 

More from Edureka!

What to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | EdurekaWhat to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | EdurekaEdureka!
 
Top 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | EdurekaTop 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | EdurekaEdureka!
 
Top 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | EdurekaTop 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | EdurekaEdureka!
 
Tableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | EdurekaTableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | EdurekaEdureka!
 
Python Programming Tutorial | Edureka
Python Programming Tutorial | EdurekaPython Programming Tutorial | Edureka
Python Programming Tutorial | EdurekaEdureka!
 
Top 5 PMP Certifications | Edureka
Top 5 PMP Certifications | EdurekaTop 5 PMP Certifications | Edureka
Top 5 PMP Certifications | EdurekaEdureka!
 
Top Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | EdurekaTop Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | EdurekaEdureka!
 
Linux Mint Tutorial | Edureka
Linux Mint Tutorial | EdurekaLinux Mint Tutorial | Edureka
Linux Mint Tutorial | EdurekaEdureka!
 
How to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| EdurekaHow to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| EdurekaEdureka!
 
Importance of Digital Marketing | Edureka
Importance of Digital Marketing | EdurekaImportance of Digital Marketing | Edureka
Importance of Digital Marketing | EdurekaEdureka!
 
RPA in 2020 | Edureka
RPA in 2020 | EdurekaRPA in 2020 | Edureka
RPA in 2020 | EdurekaEdureka!
 
Email Notifications in Jenkins | Edureka
Email Notifications in Jenkins | EdurekaEmail Notifications in Jenkins | Edureka
Email Notifications in Jenkins | EdurekaEdureka!
 
EA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | EdurekaEA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | EdurekaEdureka!
 
Cognitive AI Tutorial | Edureka
Cognitive AI Tutorial | EdurekaCognitive AI Tutorial | Edureka
Cognitive AI Tutorial | EdurekaEdureka!
 
AWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | EdurekaAWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | EdurekaEdureka!
 
Blue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | EdurekaBlue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | EdurekaEdureka!
 
Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka Edureka!
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | EdurekaA star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | EdurekaEdureka!
 
Kubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | EdurekaKubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | EdurekaEdureka!
 
Introduction to DevOps | Edureka
Introduction to DevOps | EdurekaIntroduction to DevOps | Edureka
Introduction to DevOps | EdurekaEdureka!
 

More from Edureka! (20)

What to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | EdurekaWhat to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | Edureka
 
Top 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | EdurekaTop 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | Edureka
 
Top 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | EdurekaTop 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | Edureka
 
Tableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | EdurekaTableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | Edureka
 
Python Programming Tutorial | Edureka
Python Programming Tutorial | EdurekaPython Programming Tutorial | Edureka
Python Programming Tutorial | Edureka
 
Top 5 PMP Certifications | Edureka
Top 5 PMP Certifications | EdurekaTop 5 PMP Certifications | Edureka
Top 5 PMP Certifications | Edureka
 
Top Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | EdurekaTop Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | Edureka
 
Linux Mint Tutorial | Edureka
Linux Mint Tutorial | EdurekaLinux Mint Tutorial | Edureka
Linux Mint Tutorial | Edureka
 
How to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| EdurekaHow to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| Edureka
 
Importance of Digital Marketing | Edureka
Importance of Digital Marketing | EdurekaImportance of Digital Marketing | Edureka
Importance of Digital Marketing | Edureka
 
RPA in 2020 | Edureka
RPA in 2020 | EdurekaRPA in 2020 | Edureka
RPA in 2020 | Edureka
 
Email Notifications in Jenkins | Edureka
Email Notifications in Jenkins | EdurekaEmail Notifications in Jenkins | Edureka
Email Notifications in Jenkins | Edureka
 
EA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | EdurekaEA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | Edureka
 
Cognitive AI Tutorial | Edureka
Cognitive AI Tutorial | EdurekaCognitive AI Tutorial | Edureka
Cognitive AI Tutorial | Edureka
 
AWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | EdurekaAWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | Edureka
 
Blue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | EdurekaBlue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | Edureka
 
Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | EdurekaA star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
 
Kubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | EdurekaKubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | Edureka
 
Introduction to DevOps | Edureka
Introduction to DevOps | EdurekaIntroduction to DevOps | Edureka
Introduction to DevOps | Edureka
 

Recently uploaded

Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 

Recently uploaded (20)

Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 

Markov Chains Explained with Examples and Applications

  • 1. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
  • 2. WHAT IS A MARKOV CHAIN? UNDERSTANDING MARKOV CHAINS WITH AN EXAMPLE MARKOV CHAIN IN PYTHON MARKOV CHAIN APPLICATIONS TRANSITION MATRIX & TRANSISTION STATE DIAGRAM www.edureka.co
  • 3. WHAT IS A MARKOV CHAIN? www.edureka.co
  • 4. A stochastic process containing random variables, transitioning from one state to another depending on certain assumptions and definite probabilistic rules. What Is A Markov chain? Markov Property states that the calculated probability of a random process transitioning to the next possible state is only dependent on the current state and time and it is independent of the series of states that preceded it. Let the random process be, { 𝑋 𝑚 , m=0,1,2 … } This process is a Markov chain only if, 𝑃 𝑋 𝑚+1 = ȁ𝑗 𝑋 𝑚 = ⅈ, 𝑋 𝑚−1 = ⅈ 𝑚−1, … , 𝑋0 = ⅈ0 = 𝑃 𝑋 𝑚+1 = ȁ𝑗 𝑋 𝑚 = ⅈ 𝑃𝑖𝑗 = 𝑃 𝑋 𝑚+1 = ȁ𝑗 𝑋 𝑚 = ⅈ www.edureka.co
  • 6. A Markov Model is a stochastic model that models random variables in such a manner that the variables follow the Markov property. • Keys denote the unique words in the sentence, i.e., 5 keys (one, two, hail, happy, edureka) • Tokens denote the total number of words, i.e. 8 tokens. one edureka two edureka hail edureka happy edureka www.edureka.co
  • 7. A Markov Model is a stochastic model that models random variables in such a manner that the variables follow the Markov property. one edureka two hail happy 1 4 1 1 1 Keys Frequencies www.edureka.co
  • 8. A Markov Model is a stochastic model that models random variables in such a manner that the variables follow the Markov property. one edureka two hail happy 1 4 1 1 1 Weighted distributions: 1. 'edureka' is 50% (4/8) 2. (one, two, hail, happy) is ≈ 13% (1/8) www.edureka.co
  • 9. Start one edureka two edureka hail edureka happy edureka end one edureka two hail happy 1 4 1 1 1 start end 1 1 Keys Frequencies www.edureka.co
  • 10. (Start, one) (one, edureka) (edureka, two) (two, edureka) (edureka, hail) (hail, edureka) (edureka, happy) (happy, edureka) (edureka, end) (end, none) (Start, one) (one, edureka) (edureka, two) (edureka, hail) (edureka, happy) (edureka, end) (two, edureka) (hail, edureka) (happy, edureka) (end, none) www.edureka.co
  • 11. (Start, one) (one, edureka) (edureka, two) (edureka, hail) (edureka, happy) (edureka, end) (two, edureka) (hail, edureka) (happy, edureka) (end, none) Start [one] One [edureka] Edureka [two, hail, happy, end] Two [edureka] Hail [edureka] Happy [edureka] End [none] www.edureka.co
  • 12. Start One hailtwo happy end edureka 1 1 1 1 1 1/4 1/4 1/4 1/4 Start [one] One [edureka] Edureka [two, hail, happy, end] Two [edureka] Hail [edureka] Happy [edureka] End [none] www.edureka.co
  • 13. TRANSITION MATRIX & STATE DAIGRAM www.edureka.co
  • 14. In a Markov Process, we use a matrix to represent the transition probabilities from one state to another. This matrix is called the Transition or probability matrix. It is usually denoted by P. What Is A Transition Matrix? 𝑝11 𝑝12 𝑝1𝑟 𝑝21 𝑝22 𝑝2𝑟 𝑝21 𝑝22 𝑝2𝑟 . . . . . . . . . . . . . . . . . P = ෍ 𝑘=1 𝑟 𝑝𝑖𝑘 = ෍ 𝑘=1 𝑟 𝑃 𝑋 𝑚+1 = ȁ𝑘 𝑋 𝑚 = ⅈ Note, 𝑝ij ≥ 0, and 'i' for all values is, www.edureka.co
  • 15. Consider a Markov chain with three states 1, 2, and 3. Transition Matrix & State Diagram Example Transition matrix 1/4 0 3/4 P = 1/2 0 1/2 1/4 1/2 1/4 1 2 3 1/4 3/4 1/2 1/2 1/4 1/2 1/4 State Transition Diagram www.edureka.co
  • 17. To apply Markov Property and create a Markov Model that can generate text simulations by studying Donald Trump speech data set. Problem Statement Apply Markov property Generate Text Simulations Donald Trump speeches www.edureka.co
  • 19. Markov Chain Applications Google PageRank Autocomplete www.edureka.co
  • 20. Markov Chain Applications Subreddit simulator Text generator www.edureka.co
  • 21. Copyright © 2017, edureka and/or its affiliates. All rights reserved. www.edureka.co