【强化学习的数学理论:基础概念】

B站听课笔记:
对强化学习原理的基本了解,后续将深入学习。

State

The status of the agent with respect to the environment.
即agent相对于environment的一个状态。

State space

the set of all states.一个状态集,即状态空间。

Action

For each state, there are five possible actions: a1,a2,a3,a4,a5.
对于每种状态,都有对应可能存在的动作。

Action space of a state

the set of all possible actions of a state.一个状态的动作集。

State transition

When taking an action, the agent may move from one state to another.
即状态转换。
State transition定义了状态和环境的一种交互interaction行为。

表达形式
  • Tabular representation 表格表示法
    比较直观,但使用受限,只能表示确定性的情况 deterministic cases。
  • State transition probability 状态转移概率法
    使用条件概率来数学描述:
    p ( s 2 ∣ s 1 , a 2 ) = 1 p ( s i ∣ s 1 , a 2 ) = 0   ∀ i ≠ 2 p(s_2|s_1,a_2)=1 \\ p(s_i|s_1,a_2)=0 \ {\forall} i≠2 p(s2s1,a2)=1p(sis1,a2)=0 i=2
    利用deterministic的条件概率,可以来描述随机性stochastic的例子。

Policy

tells the agent what actions to take at a state. 决策,策略。
当agent在某个state时,policy能说明下一步的action。

表达方式
  • Intuitive representation
    可用箭头来表示一个决策。
    基于policy,能得到一个整体的路径path
  • Mathematical representation
    用条件概率conditional probability来表示。
    For example, for state s 1 s_1 s1:
    一种确定性deterministic的情况:
    π ( a 1 ∣ s 1 ) = 0 π ( a 2 ∣ s 1 ) = 1 π ( a 3 ∣ s 1 ) = 0 π ( a 4 ∣ s 1 ) = 0 π ( a 5 ∣ s 1 ) = 0 \pi (a_1|s_1)=0 \\ \pi (a_2|s_1)=1\\ \pi (a_3|s_1)=0\\ \pi (a_4|s_1)=0\\ \pi (a_5|s_1)=0 π(a1s1)=0π(a2s1)=1π(a3s1)=0π(a4s1)=0π(a5s1)=0
    一种不确定性stochastic的情况:
    π ( a 1 ∣ s 1 ) = 0 π ( a 2 ∣ s 1 ) = 0.5 π ( a 3 ∣ s 1 ) = 0.5 π ( a 4 ∣ s 1 ) = 0 π ( a 5 ∣ s 1 ) = 0 \pi (a_1|s_1)=0 \\ \pi (a_2|s_1)=0.5\\ \pi (a_3|s_1)=0.5\\ \pi (a_4|s_1)=0\\ \pi (a_5|s_1)=0 π(a1s1)=0π(a2s1)=0.5π(a3s1)=0.5π(a4s1)=0π(a5s1)=0
    【注意】对于编程中,如何实现不确定性的一种情况?
  • 先在0-1中随机生成数x,当x位于[0,0.5],则action为 a 2 a_2 a2;当x位于[0.5,1],则action为 a 3 a_3 a3

Reward

a real number we get after taking an action.
在action之后,得到的一个数。

  • An positive reward——encouragement奖励
  • An negative reward——punishment惩罚
  • A zero reward——no punishment
  • 【注意】 positive can mean punishment.

Reward 能作为一种人机交互的手段human-machine interface
人通过reward,能让机器往着人所需求的方面前进。

Reward取决于当前的state和action,而不是下一个state。

对于一个deterministic事件,the reward transition是随机的stochastic。
当获得reward时,具体获得多少,是不确定的。

Trajectory and return

Trajectory

是state-action-reward的链式。

return

是针对于一个Trajectory而言,将其上面所有reward的总和。

return的作用:
用来评估一个policy的好坏。

Discounted return

一个trajectory的return处于发散的时候,可以引入折扣因子dicounted rate γ ∈ [ 0 , 1 ) \gamma \in [0,1) γ[0,1),则:
d i s c o u n t e d   r e t u r n = ∑ i n γ i ∗ r i discounted \ return= \sum _i ^n \gamma ^i *r_i discounted return=inγiri
引入discounted return的作用:

  • 将发散的return收敛;
  • 平衡远处和近处的reward:
    通过控制 γ \gamma γ,能控制agent所学到的策略:
    减小 γ \gamma γ,会使得其更加近视——注重最近的reward;
    增大 γ \gamma γ,会使得其更加远视——注重长远的reward。

Episode

或者称为trial
解释:一个trajectory,其中含有最终停止的state,即terminal state。

一个episode通常是有限步的,含有episode的task也被称为episodic task。

若一个任务没有terminal states,那么该任务也被称为continuing tasks。

一般不区分episodic task和continuing task。
两种将episodic task转换为continuing task的方法:

  • 将target state视为一种特殊的absorbing state。即当agent达到target state的时候,不会再采取其他的action离开该state,也就是说,把action space设置为0。同时,将之后得到的所有reward都为0,即 γ = 0 \gamma =0 γ=0
  • 将target state视为一种普通的state,若留在target state,则一直获得 γ = + 1 \gamma = +1 γ=+1。这种方法对目标不区别对待。更加一般化。

Markov dicision process(MDP)

MDP的所有key element:

  • Sets:
    State- S S S
    Action- A ( s ) ,   s ∈ S A(s) ,\ s \in S A(s), sS
    Reward- R ( s , a ) R(s,a) R(s,a)
  • Probability distribution
    State transition probability-当前在 s s s处采取行动 a a a跳到 s ′ s' s的概率: p ( s ′ ∣ s , a ) p(s'|s,a) p(ss,a)
    Reward probability-当前在 s s s处采取行动 a a a得到 r e w a r d = r reward = r reward=r的概率: p ( r ∣ s , a ) p(r|s,a) p(rs,a)
  • Policy:
    当前在 s s s处采取行动 a a a的概率: π ( a ∣ s ) \pi (a|s) π(as)
  • M a r k o v   p r o p e r t y Markov \ property Markov property:memoryless property,即与历史无关的一种性质。
    p ( s t + 1 ∣ a t + 1 , s t , . . . , a 1 , s 0 ) = p ( s t + 1 ∣ a t + 1 , s t ) , p ( r t + 1 ∣ a t + 1 , s t , . . . , a 1 , s 0 ) = p ( r t + 1 ∣ a t + 1 , s t ) . p(s_{t+1}|a_{t+1},s_t,...,a_1,s_0) = p(s_{t+1}|a_{t+1},s_t), \\ p(r_{t+1}|a_{t+1},s_t,...,a_1,s_0) = p(r_{t+1}|a_{t+1},s_t). p(st+1at+1,st,...,a1,s0)=p(st+1at+1,st),p(rt+1at+1,st,...,a1,s0)=p(rt+1at+1,st).

【助记:MDP】

  • M- M a r k o v   p r o p e r t y Markov \ property Markov property,
  • D-Policy,
  • P-Sets+ Probability distribution.
M a r k o v   p r o c e s s Markov \ process Markov process

MDP包括了所有的process。
当MDP中的policy一旦确定了,则为 M a r k o v   p r o c e s s Markov \ process Markov process

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小翔很开心

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值