Presentation is loading. Please wait.

Presentation is loading. Please wait.

Markov Models Introduction to Artificial Intelligence COS302 Michael L. Littman Fall 2001.

Similar presentations


Presentation on theme: "Markov Models Introduction to Artificial Intelligence COS302 Michael L. Littman Fall 2001."— Presentation transcript:

1 Markov Models Introduction to Artificial Intelligence COS302 Michael L. Littman Fall 2001

2 Administration Hope your midterm week is going well.

3 Breaking the Bank Assistant professor: $20k/year. How much total cash? 20+20+20+20+… = infinity! Nice, eh?

4 Discounted Rewards Idea: The promise of future payment is not worth quite as much as payment now. Inflation / investingInflation / investing Chance of game “ending”Chance of game “ending” Ex. $10k next year might be worth $10k x 0.9 today.

5 Infinite Sum Assuming a discount rate of 0.9, how much does the assistant professor get in total? 20 +.9 20 +.9 2 20 +.9 3 20 + … = 20 +.9 (20 +.9 20 +.9 2 20 + …) x = 20 +.9 x x = 20/(.1) = 200

6 Academic Life A.Assistant Prof.: 20 B. Associate Prof.: 60 T. Tenured Prof.: 100 S. Out on the Street: 10 D. Dead: 0 1.0 0.6 0.2 0.7 0.3 0.6 0.2 0.7 0.3

7 Solving for Total Reward L(i) is expected total reward received starting in state i. How could we compute L(A)? Would it help to compute L(B), L(T), L(S), and L(D) also?

8 Working Backwards A.Assistant Prof.: 20 B. Associate Prof.: 60 T. Tenured Prof.: 100 S. Out on the Street: 10 D. Dead: 0 1.0 0.6 0.2 0.7 0.3 0.6 0.2 0.7 0.3 Discount factor 0.9 0 270 27 247 151

9 Reincarnation? A.Assistant Prof.: 20 B. Associate Prof.: 60 T. Tenured Prof.: 100 S. Out on the Street: 10 D. Dead: 0 0.5 0.6 0.2 0.7 0.3 0.6 0.2 0.7 0.3 Discount factor 0.9 0.5

10 System of Equations L(A) = 20 +.9(.6 L(A) +.2 L(B) +.2 L(S)) L(B) = 60 +.9(.6 L(B) +.2 L(S) +.2 L(T)) L(S) = 10 +.9(.7 L(S) +.3 L(D)) L(T) = 100 +.9(.7 L(T) +.3 L(D)) L(D) = 0 +.9 (.5 L(D) +.5 L(A))

11 Transition Matrix Let P be the matrix of probs: Pij = Pr(next = j | current = i) 0.60.20.2 0.60.20.2 0.70.3 0.70.3 0.50.5 ABSTD A B S T D From To

12 Matrix Equation L = R +  P L L = R +  P L.6.2.2.6.2.2.7.3.7.3.5.5 L(A)L(B)L(S)L(T)L(D)L(A)L(B)L(S)L(T)L(D) 20+.960+.910+.9100+.90+.9 =====

13 Solving the Equation L = R +  P L L -  P L = R I L -  P L = R (introduce identity) (I -  P) L = R (I -  P) -1 (I -  P) L = (I -  P) -1 R L = (I -  P) -1 R Matrix inversion, matrix-vec mult.

14 Markov Chain Set of states, transitions from state to state. Transitions only depend on current state, not the history: Markov property.

15 What Does a MC Do? A: 20 B: 80 D: 100 C: 10 E: 0 0.5 0.6 0.2 0.7 0.3 0.6 0.2 0.7 0.3 0.5

16 MC Problems Probability of going from s to s’ in t steps.Probability of going from s to s’ in t steps. Probability of going from s to s’ in t or fewer steps.Probability of going from s to s’ in t or fewer steps. Averaged over t steps (in the limit), how often in state s’ starting at s?Averaged over t steps (in the limit), how often in state s’ starting at s? How many steps from s to s’, on average?How many steps from s to s’, on average? Given reward values, expected discounted reward starting at s.Given reward values, expected discounted reward starting at s.

17 Examples Queuing system: Expected queue length, time until queue fills up. Chutes & Ladders: Avg game time. Genetic Algs: Time to find opt. Statistics: Time to “mix”. Blackjack: Expected winnings. Robot: Prob. of crash given controller. Gamblers ruin: Time until money gone.

18 Gambler’s Ruin Gambler has 3 dollars. Win a dollar with prob. 1/3. Lose a dollar with prob. 2/3. Fail: no dollars. Succeed: Have 5 dollars. Probability of success? Average time until success or failure? Set up Markov chains.

19 Ruin Chain Solve for L(3) using  =1. Gives probability of success. 012345 1/3 2/3 1 1 1 +1

20 Gambling Time Chain Solve for L(3) using  =1. L(3) will be the number of steps in 1, 2, 3, 4 states before finishing. 012345 1/3 2/3 1 1 +1

21 Stationary Distribution What fraction of the time is spent in D? L(D) = 0.7 L(D) + 0.2 L(B) 0.7 L(D) + 0.2 L(B) Also: L(A)+L(B)+L(C)+L(D)+L(E) = 1 A B D C E 0.5 0.6 0.2 0.7 0.3 0.6 0.2 0.7 0.3 0.5

22 Other Uses: Uncertainty Can add a notion of “actions” to create a Markov decision process. Useful for AI planning. Can add a notion of “observation” to create hidden Markov model (we’ll see these later). Add both to get partially observable Markov decision process (POMDP).

23 What to Learn Solving for the value of Markov processes using matrix equations. Setting up problems as Markov chains.

24 Homework 5 (due 11/7) 1.The value iteration algorithm from the Games of Chance lecture can be applied to deterministic games with loops. Argue that it produces the same answer as the “Loopy” algorithm from the Game Tree lecture. 2.Write the matrix form of the game tree below.

25 Game Tree X-1 +2 +4 Y-2 Y-3 X-4 L R L R L R +5 L +2 R

26 Continued 3. How many times (on average) do you need to flip a coin before you flip 3 heads in a row? (a) Set this up as a Markov chain, and (b) solve it. 4. More soon…


Download ppt "Markov Models Introduction to Artificial Intelligence COS302 Michael L. Littman Fall 2001."

Similar presentations


Ads by Google