Skip to main content

RL 003

· 5 min read

Markov Property

  • The future is independent of the past given the present state.
  • The current state is sufficient to determine the future, without history.

Markov State

P[St+1St]=P[St+1=sSt=s]P[S_{t+1} | S_t] = P[S_{t+1} = s' | S_t = s]

  • tt: Time step
  • St+1S_{t+1}: Next state
  • StS_t: Current state
  • S1,,StS_1, \ldots, S_t: History (All previous states)

State Transition Probability

Pss=P[St+1=sSt=s]P_{ss'} = P[S_{t+1} = s' | S_t = s]

  • Likelihood or probability of moving from one state ss to another state ss' in the next time step t+1t+1.
  • ss: Markov State
  • ss': Successor State
  • tt: Time step
  • State transition matrix PP defines the transitions probabilities between all states ss to all successor states ss'.

State Transition Matrix

P=s1sn(to state)s1sn[P11P1nPn1Pnn](from state)\mathcal{P} = \begin{array}{rl} & \begin{matrix} \textcolor{red}{\boldsymbol{s_1}} & \textcolor{red}{\boldsymbol{\dots}} & \textcolor{red}{\boldsymbol{s_n}} \end{matrix} \quad \leftarrow \text{(to state)} \\ \begin{matrix} \textcolor{red}{\boldsymbol{s_1}} \\ \textcolor{red}{\boldsymbol{\vdots}} \\ \textcolor{red}{\boldsymbol{s_n}} \end{matrix} & \hspace{-10pt} \begin{bmatrix} \mathcal{P}_{11} & \dots & \mathcal{P}_{1n} \\ \vdots & \ddots & \vdots \\ \mathcal{P}_{n1} & \dots & \mathcal{P}_{nn} \end{bmatrix} \\ \begin{matrix} \uparrow \\[-2pt] \mathclap{\text{(from state)}} \end{matrix} & \end{array}
  • State transition matrix PP defines the transition probabilities between all states ss to all successor states ss'.
  • Probability of moving from state sns_n to s1s_1 is Pn1\mathcal{P}_{n1}.

Math cal

Reinforcement Learning and Math Major Symbols

  • P\mathcal{P}: Transition Probability Matrix
  • S\mathcal{S}: State Space
  • A\mathcal{A}: Action Space
  • R\mathcal{R}: Reward Function
  • L\mathcal{L}: Loss Function
  • N(μ,σ2)\mathcal{N}(\mu, \sigma^2): Normal Distribution
  • D\mathcal{D}: Dataset
  • H\mathcal{H}: Entropy / Hypothesis Space

Markov Process

Markov Chain

  • What is going to be happened next?
  • it goes through a sequence of states overtime.
  • Stochastic Process: The next state St+1S_{t+1} is determined by the current state StS_t and the transition probability matrix PP that exhibits the Markov Property.
  • Current state is independent of the past states.
  • Memoryless: History of states leading up to the current state is not necessary to predict the next/future state.
  • MP: S,P\langle\mathcal{S},\mathcal{P}\rangle, What states comes next?, Observer's Perspective.
  • MRP: S,P,R,γ\langle\mathcal{S},\mathcal{P},\mathcal{R},\gamma\rangle, How good/How much reward is this state in the long run?, Evaluator's Perspective.
  • MDP: S,A,P,R,γ\langle\mathcal{S},\mathcal{A},\mathcal{P},\mathcal{R},\gamma\rangle, What action should I take right now to maximize the long-term reward?, Decision Maker's Perspective.

Pss=P[St+1=sSt=s]\mathcal{P}_{ss'} = P[S_{t+1} = s' | S_t = s]

  • SS: a finite set of states.
  • P\mathcal{P}: a state transition matrix, defines the transitions probabilities from all states ss to all successor states ss'.
  • NO REWARD, NO ACTIONS.

Transition Diagram

Moon Rover Transition Diagram

  • Box: where it ends
  • Arrow: transitions
  • Circle: states
  • Number: probability of transitioning to the state
P=[00.10.50.100.30.40.10.500000.50.50000.5000.20.300.70000.30000001]\mathcal{P} = \begin{bmatrix} 0 & 0.1 & 0.5 & 0.1 & 0 & 0.3 \\ 0.4 & 0.1 & 0.5 & 0 & 0 & 0 \\ 0 & 0.5 & 0.5 & 0 & 0 & 0 \\ 0.5 & 0 & 0 & 0.2 & 0.3 & 0 \\ 0.7 & 0 & 0 & 0 & 0.3 & 0 \\ 0 & 0 & 0 & 0 & 0 & 1 \end{bmatrix}
  • S1: Calibration Site
  • S2: Mineral Site
  • S3: Water Site
  • S4: Drill Site
  • S5: Alien Remain Site
  • S6: Lander Site

Markov Chain Episode

  • A sequence of states from a starting state to a terminal state.
  • S1,S3,S2,S1,S6S_1, S_3, S_2, S_1, S_6
  • S1,S3,S3,S2,S1,S4,S4,S1,S6S_1, S_3, S_3, S_2, S_1, S_4, S_4, S_1, S_6

Episodic Task vs Continuous Task

FeatureEpisodic TasksContinuing Tasks
TerminationHas a well-defined terminal state (TT)Runs indefinitely without termination (T=T = \infty)
Real-World Examples• Video games (e.g., Super Mario: level clear or death)
• Navigation (reaching destination)
• Board games (e.g., Chess: checkmate/draw)
• Smart thermostat (HVAC temperature control)
• 24/7 industrial robotic process control
• Automated trading & server load management
Execution FlowEnvironment resets to a start state once finishedOperates continuously without automatic resets
  • Episodic Tasks: Tasks with a defined end/terminal state.
  • Continuing Tasks: Tasks without a defined end/terminal state.
  • It may require different MDP formulation and solution methods for each type of task.

Markov Reward Process

Markov Chain + Reward

S,P,R,γ\langle\mathcal{S},\mathcal{P},\mathcal{R},\gamma\rangle

  • SS: a finite set of states.
  • P\mathcal{P}: a state transition matrix (Transition Dynamics)
  • R\mathcal{R}: a reward function to compute expected reward from a state.
    • Rs=E[Rt+1St=s]\mathcal{R}_s = \mathbb{E}[R_{t+1} | S_t = s]
    • In the state ss, how much reward can you expect to get in the next time step?
  • γ\gamma: a discount factor, to balance the immediate and future rewards.
    • γ[0,1]\gamma \in [0, 1]

Reward diagram

Return

Gt=Rt+1+Rt+2++RTG_t = R_{t+1} + R_{t+2} + \cdots + R_T

  • GtG_t: Goal Reward
    • The sum of the rewards received from time step tt.
  • Rt+1,Rt+2,,RTR_{t+1}, R_{t+2}, \ldots, R_T: the sequence of rewards received after time step tt
  • TT: terminal state
  • tt: time step

Discount

  • The present value of future rewards.
  • γ=0\gamma = 0: Myopic evaluation for maximizing immediate reward.
  • γ=1\gamma = 1: Far-sighted/Long-term evaluation for maximizing future reward.

Discounted Return

Gt=Rt+1+γRt+2+γ2Rt+3++γTt1RT=k=0γkRt+k+1G_t = R_{t+1} + \gamma R_{t+2} + \gamma^2 R_{t+3} + \cdots + \gamma^{T-t-1} R_T = \sum_{k=0}^{\infty} \gamma^k R_{t+k+1}

  • GtG_t: Discounted Return
  • γ=1\gamma = 1: Undiscounted Markov Reward Process, if all sequences terminate (like games)