Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help solve this coding question. Please show the script and the result. Thank you 2 Markov Chairn (50 points) l1 Pik Markov chain transition

Please help solve this coding question. Please show the script and the result. Thank you
image text in transcribed
2 Markov Chairn (50 points) l1 Pik Markov chain transition matrix P, and probability distribution on the states p 1. 0s Pli,j] s1: probability to go from state i to statej 2. Transition rule: ewPT pold 3. normalization : all (sum (Paris-|)-= 1), psum ()-= 1 Write a Python script named markov chain.py that works with 5 states, and: Constructs a random matrix, and normalizes each row so that it is a transition matrix Starts from a random (normalized) probability distribution p and take 50 steps to obtain p 50. Computes the stationary distribution: the eigenvector of P.T with eigenvalue 1 (numerically the eigenvalue closest to 1) to obtain p stationary (remember to normalize the eigenvector). Check if p 50 and p_stationary are equal to tolerance le-5. The following functions may be useful: np.random.rand, dot0, np.linalg.eig, etc. 2 Markov Chairn (50 points) l1 Pik Markov chain transition matrix P, and probability distribution on the states p 1. 0s Pli,j] s1: probability to go from state i to statej 2. Transition rule: ewPT pold 3. normalization : all (sum (Paris-|)-= 1), psum ()-= 1 Write a Python script named markov chain.py that works with 5 states, and: Constructs a random matrix, and normalizes each row so that it is a transition matrix Starts from a random (normalized) probability distribution p and take 50 steps to obtain p 50. Computes the stationary distribution: the eigenvector of P.T with eigenvalue 1 (numerically the eigenvalue closest to 1) to obtain p stationary (remember to normalize the eigenvector). Check if p 50 and p_stationary are equal to tolerance le-5. The following functions may be useful: np.random.rand, dot0, np.linalg.eig, etc

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Issues In Database Management A Refernce For The Thinking Practitioner

Authors: Fabian Pascal

1st Edition

0201485559, 978-0201485554

More Books

Students also viewed these Databases questions

Question

What roles have these individuals played in your life?

Answered: 1 week ago