Calculate probabilities for Markov Chain - Python

0 votes

I am trying to figure out the concepts behind Markov Chain.

print zip(s,s[1:])
[('D', 'E'), ('E', 'F'), ('F', 'E'), ('E', 'E'), ('E', 'F'), ('F', 'H'), ('H', 'F')]

How do I find the probability of the above data?

Aug 2 in Machine Learning by Viky
12 views

1 answer to this question.

0 votes

You have to use the tuples from the zip to index the dictionary and then multiply all the numbers.

from operator import mul
print reduce(mul, (dict_m[t] for t in zip(s, s[1:])))
answered Aug 2 by Ishaan

Related Questions In Machine Learning

0 votes
1 answer

Markov chain using processing - Python

Try something like this @Gujjar HashMap<String, int> wordCount; int ...READ MORE

answered Aug 2 in Machine Learning by Ashish
12 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 176 views
0 votes
1 answer