强化学习读书笔记 - 10 - on-policy控制的近似方法

学习笔记:
Reinforcement Learning: An Introduction, Richard S. Sutton and Andrew G. Barto c 2014, 2015, 2016

参照

需要了解强化学习的数学符号,先看看这里:

on-policy控制的近似方法

近似控制方法(Control Methods)是求策略的行动状态价值\(q_{\pi}(s, a)\)的近似值\(\hat{q}(s, a, \theta)\)。

半梯度递减的控制Sarsa方法 (Episodic Semi-gradient Sarsa for Control)

Input: a differentiable function \(\hat{q} : \mathcal{S} \times \mathcal{A} \times \mathbb{R}^n \to \mathbb{R}\)

Initialize value-function weights \(\theta \in \mathbb{R}^n\) arbitrarily (e.g., \(\theta = 0\))
Repeat (for each episode):
  \(S, A \gets\) initial state and action of episode (e.g., "\(\epsilon\)-greedy)
  Repeat (for each step of episode):
   Take action \(A\), observe \(R, S'\)
   If \(S'\) is terminal:
    \(\theta \gets \theta + \alpha [R - \hat{q}(S, A, \theta)] \nabla \hat{q}(S, A, \theta)\)
    Go to next episode
   Choose \(A'\) as a function of \(\hat{q}(S', \dot \ , \theta)\) (e.g., \(\epsilon\)-greedy)
   \(\theta \gets \theta + \alpha [R + \gamma \hat{q}(S', A', \theta) - \hat{q}(S, A, \theta)] \nabla \hat{q}(S, A, \theta)\)
   \(S \gets S'\)
   \(A \gets A'\)

多步半梯度递减的控制Sarsa方法 (n-step Semi-gradient Sarsa for Control)

请看原书,不做拗述。

(连续性任务的)平均奖赏

由于打折率(\(\gamma\), the discounting rate)在近似计算中存在一些问题(说是下一章说明问题是什么)。
因此,在连续性任务中引进了平均奖赏(Average Reward)\(\eta(\pi)\):
\[
\begin{align}
\eta(\pi)
& \doteq \lim_{T \to \infty} \frac{1}{T} \sum_{t=1}{T} \mathbb{E} [R_t | A_{0:t-1} \sim \pi] \\
& = \lim_{t \to \infty} \mathbb{E} [R_t | A_{0:t-1} \sim \pi] \\
& = \sum_s d_{\pi}(s) \sum_a \pi(a|s) \sum_{s',r} p(s,r'|s,a)r
\end{align}
\]

  • 目标回报(= 原奖赏 - 平均奖赏)
    \[
    G_t \doteq R_{t+1} - \eta(\pi) + R_{t+2} - \eta(\pi) + \cdots
    \]

  • 策略价值
    \[
    v_{\pi}(s) = \sum_{a} \pi(a|s) \sum_{r,s'} p(s',r|s,a)[r - \eta(\pi) + v_{\pi}(s')] \\
    q_{\pi}(s,a) = \sum_{r,s'} p(s',r|s,a)[r - \eta(\pi) + \sum_{a'} \pi(a'|s') q_{\pi}(s',a')] \\
    \]

  • 策略最优价值
    \[
    v_{*}(s) = \underset{a}{max} \sum_{r,s'} p(s',r|s,a)[r - \eta(\pi) + v_{*}(s')] \\
    q_{*}(s,a) = \sum_{r,s'} p(s',r|s,a)[r - \eta(\pi) + \underset{a'}{max} \ q_{*}(s',a')] \\
    \]

  • 时序差分误差
    \[
    \delta_t \doteq R_{t+1} - \bar{R} + \hat{v}(S_{t+1},\theta) - \hat{v}(S_{t},\theta) \\
    \delta_t \doteq R_{t+1} - \bar{R} + \hat{q}(S_{t+1},A_t,\theta) - \hat{q}(S_{t},A_t,\theta) \\
    where \\
    \bar{R} \text{ - is an estimate of the average reward } \eta(\pi)
    \]

  • 半梯度递减Sarsa的平均奖赏版
    \[
    \theta_{t+1} \doteq \theta_t + \alpha \delta_t \nabla \hat{q}(S_{t},A_t,\theta)
    \]

半梯度递减Sarsa的平均奖赏版(for continuing tasks)

Input: a differentiable function \(\hat{q} : \mathcal{S} \times \mathcal{A} \times \mathbb{R}^n \to \mathbb{R}\)
Parameters: step sizes \(\alpha, \beta > 0\)

Initialize value-function weights \(\theta \in \mathbb{R}^n\) arbitrarily (e.g., \(\theta = 0\))
Initialize average reward estimate \(\bar{R}\) arbitrarily (e.g., \(\bar{R} = 0\))
Initialize state \(S\), and action \(A\)

Repeat (for each step):
  Take action \(A\), observe \(R, S'\)
  Choose \(A'\) as a function of \(\hat{q}(S', \dot \ , \theta)\) (e.g., \(\epsilon\)-greedy)
  \(\delta \gets R - \bar{R} + \hat{q}(S', A', \theta) - \hat{q}(S, A, \theta)\)
  \(\bar{R} \gets \bar{R} + \beta \delta\)
  \(\theta \gets \theta + \alpha \delta \nabla \hat{q}(S, A, \theta)\)
  \(S \gets S'\)
  \(A \gets A'\)

多步半梯度递减的控制Sarsa方法 - 平均奖赏版(for continuing tasks)

请看原书,不做拗述。

强化学习读书笔记 - 10 - on-policy控制的近似方法的更多相关文章

  1. 强化学习读书笔记 - 13 - 策略梯度方法(Policy Gradient Methods)

    强化学习读书笔记 - 13 - 策略梯度方法(Policy Gradient Methods) 学习笔记: Reinforcement Learning: An Introduction, Richa ...

  2. 强化学习读书笔记 - 12 - 资格痕迹(Eligibility Traces)

    强化学习读书笔记 - 12 - 资格痕迹(Eligibility Traces) 学习笔记: Reinforcement Learning: An Introduction, Richard S. S ...

  3. 强化学习读书笔记 - 11 - off-policy的近似方法

    强化学习读书笔记 - 11 - off-policy的近似方法 学习笔记: Reinforcement Learning: An Introduction, Richard S. Sutton and ...

  4. 强化学习读书笔记 - 02 - 多臂老O虎O机问题

    # 强化学习读书笔记 - 02 - 多臂老O虎O机问题 学习笔记: [Reinforcement Learning: An Introduction, Richard S. Sutton and An ...

  5. 强化学习读书笔记 - 05 - 蒙特卡洛方法(Monte Carlo Methods)

    强化学习读书笔记 - 05 - 蒙特卡洛方法(Monte Carlo Methods) 学习笔记: Reinforcement Learning: An Introduction, Richard S ...

  6. 强化学习读书笔记 - 06~07 - 时序差分学习(Temporal-Difference Learning)

    强化学习读书笔记 - 06~07 - 时序差分学习(Temporal-Difference Learning) 学习笔记: Reinforcement Learning: An Introductio ...

  7. 强化学习读书笔记 - 09 - on-policy预测的近似方法

    强化学习读书笔记 - 09 - on-policy预测的近似方法 参照 Reinforcement Learning: An Introduction, Richard S. Sutton and A ...

  8. 深度学习读书笔记之RBM(限制波尔兹曼机)

    深度学习读书笔记之RBM 声明: 1)看到其他博客如@zouxy09都有个声明,老衲也抄袭一下这个东西 2)该博文是整理自网上很大牛和机器学习专家所无私奉献的资料的.具体引用的资料请看参考文献.具体的 ...

  9. 李宏毅强化学习完整笔记!开源项目《LeeDeepRL-Notes》发布

    Datawhale开源 核心贡献者:王琦.杨逸远.江季 提起李宏毅老师,熟悉强化学习的读者朋友一定不会陌生.很多人选择的强化学习入门学习材料都是李宏毅老师的台大公开课视频. 现在,强化学习爱好者有更完 ...

随机推荐

  1. druid相关资料

    官方资料直达地址: Druid 首页 https://github.com/alibaba/druid/wiki/%E9%A6%96%E9%A1%B5 Druid 常见问题 https://githu ...

  2. OpenGL之位图的绘制和gluOrtho2D等函数详解

    位图绘制 先来段代码吧: #include <iostream> #include <gl/glut.h> using namespace std; #pragma comme ...

  3. I、Q信号是如何产生的,I、Q信号复用的作用

    接收机在中频部分实现模数变换和采样,采样后的信号和数字域的同频相乘,就可以得到基带的I.Q分量.在无线接口传输时,每一种使用特定的载波频率.码(扩频码和扰码)以及载波相对相位(I或Q)的信道都可以理解 ...

  4. ThinkPHP里面用原生SQL

    public function rewardlog(){ $adminNav = C('ADMIN_NAV'); $adminNav[1]['class'] = 'cur'; $this->as ...

  5. Unity3D-射线效果

    基于airplane_02 下面新建 Line Renderer 将上面的几个地方设置下 添加Script脚本: 脚本代码为: using System.Collections; using Syst ...

  6. Gradle Goodness: Renaming Files while Copying

    With the Gradle copy task we can define renaming rules for the files that are copied. We use the ren ...

  7. EF Core中如何正确地设置两张表之间的关联关系

    数据库 假设现在我们在SQL Server数据库中有下面两张表: Person表,代表的是一个人: CREATE TABLE [dbo].[Person]( ,) NOT NULL, ) NULL, ...

  8. linux内核追踪(trace)(QEMU+gdb)

    1.引言 Linux内核是一个很大的模块,如果只是看源码有时会难以理解Linux内核的一些代码设计情况,如果可以结合Linux内核运行同时阅读源码再好不过,本文大致介绍Linux内核追踪方式,采用工具 ...

  9. [原创]HBase学习笔记(2)- 基本操作

    1.使用hbase shell连接hbase 2.输入help可以查看帮助 3.输入list查看当前hbase中的所有表 4.使用create创建表test 其中test是表名,cf是列族.该表只创建 ...

  10. ios - 沙盒和NSBundle

    沙盒 1.沙盒机制介绍 iOS中的沙盒机制是一种安全体系.每个iOS程序都有一个独立的文件系统(存储空间),而且只能在对应的文件系统中进行操作,此区域被称为沙盒.应用必须待在自己的沙盒里,其他应用不能 ...