Page Nav

HIDE

Grid

GRID_STYLE

Pages

Markov Chain

 Introduction When random variables sequentially distributed where each variable follows the Markov assumption. Now, what is Markov's as...

 Introduction

When random variables sequentially distributed where each variable follows the Markov assumption. Now, what is Markov's assumption? When a sequence of events depends probabilistically on the previous event that is known as Markov assumption. Markov chain based on a stochastic model that set out possible events sequentially.

This report is a part of the Artificial Intelligence course Lab-work under supervision of Nuruzzaman Faruqui, Lecturer of City University, Bangladesh. This course offers students various up-to-date AI topics. Students get to explore the real applicable approaches through AI. From this course, the student acquires better knowledge of the functionality of AI and how AI is making our daily life easier. This is the best Artificial Intelligence course in Bangladesh.

 

Problem Statement 

Let’s make a Markov chain by a transition model. That transition model will set out the probability distribution of the next event.


 

From the above figure, the probability of tomorrow will be a sunny day based on today being a sunny day is 0.8. If it is rainy today, the probability of rain tomorrow is 0.7. It is reasonable since rainy days are more likely to follow each other. Using this transition model, we will make a Markov chain on python code.

 


 

Code Explanation

from pomegranate import *
# Define starting probabilities
start = DiscreteDistribution({
   
"sun": 0.5,
   
"rain": 0.5
})
# Define transition model
transitions = ConditionalProbabilityTable([
    [
"sun", "sun", 0.8],
    [
"sun", "rain", 0.2],
    [
"rain", "sun", 0.3],
    [
"rain", "rain", 0.7]
], [start])
# Create Markov chain
model = MarkovChain([start, transitions])
# Sample 50 states from chain
print(model.sample(
50))

 

Result

After executing the code, we get the following output.


 

Conclusion

As you have learned Markov chain is a widely used algorithm in a variety of areas. Such as Predicting traffic flows, communication networks, genetic issues, and many more. So, it is better to get a good working-knowledge about the Markov chain. This topic comes from statistics. The creator of this Markov chain is even a mathematician. That’s the beauty of computer science. With math, it’s making ground-breaking inventions.

As you can probably tell now how easily this concept is described above. Anyone with basic mathematics knowledge can understand this. Our honorable instructor’s well-explained teaching method is the main reason for successfully grasping every topic of this course quickly. That’s why this is the best AI course in Bangladesh.

No comments