【论文_2000】REINFORCE 和 actor-critic 等策略梯度方法的局部收敛性证明

news2024/9/28 7:16:13
  • 部分证明不太理解

SUTTON R S, MCALLESTER D A, SINGH S P, et al. Policy gradient methods for reinforcement learning with function approximation [C] // Advances in neural information processing systems, 2000: 1057-1063. 【PDF 链接】

在这里插入图片描述

文章目录

  • 摘要
  • 引言
  • 1 策略梯度定理
  • 2 策略梯度 近似
  • 3 推导算法 和 优势的应用
  • 4 函数近似的策略梯度的收敛性
  • 致谢
  • 参考文献
  • 附录: 定理 1 的证明

摘要

Function approximation is essential to reinforcement learning, but the standard approach of approximating a value function and determining a policy from it has so far proven theoretically intractable.
函数近似 对强化学习至关重要,但近似一个价值函数并从中确定策略的标准方法迄今为止在理论上被证明是难以解决的。
In this paper we explore an alternative approach in which the policy is explicitly represented by its own function approximator, independent of the value function, and is updated according to the gradient of expected reward with respect to the policy parameters.
在本文中,我们探索了一种替代方法,其中策略由其自己的函数近似器显式表示,独立于价值函数,并根据期望奖励 相对于 策略参数的梯度进行更新。
Williams’s REINFORCE method and actor-critic methods are examples of this approach.
Williams 的 REINFORCE 方法 和 actor-critic 方法都是这种方法的例子。
Our main new result is to show that the gradient can be written in a form suitable for estimation from experience aided by an approximate action-value or advantage function.
我们的主要新结果是表明梯度可以写成一种适合于由近似 动作-价值 或 优势函数 辅助的经验估计的形式。
Using this result, we prove for the first time that a version of policy iteration with arbitrary differentiable function approximation is convergent to a locally optimal policy.
利用这一结果,我们首次证明了具有任意可微函数近似的策略迭代 收敛于 局部最优策略

引言

Large applications of reinforcement learning (RL) require the use of generalizing function approximators such neural networks, decision-trees, or instance-based methods.
强化学习 (RL) 的大规模应用需要使用泛化函数近似器,如神经网络、决策树或基于实例的方法。
The dominant approach for the last decade has been the value-function approach, in which all function approximation effort goes into estimating a value function, with the action-selection policy represented implicitly as the “greedy” policy with respect to the estimated values (e.g., as the policy that selects in each state the action with highest estimated value).
在过去十年中,占主导地位的方法是价值函数方法,其中所有的函数近似努力都用于估计价值函数,动作选择策略隐含地表示为相对于估计的价值的“贪婪”策略 (例如,作为 在每个状态中选择具有最高价值估计的动作 的策略)。
The value-function approach has worked well in many applications, but has several limitations.
价值函数方法在许多应用程序中工作得很好,但有一些限制。
First, it is oriented toward finding deterministic policies, whereas the optimal policy is often stochastic, selecting different actions with specific probabilities (e.g., see Singh, Jaakkola, and Jordan, 1994).
首先,它倾向于寻找确定性策略,而最优策略通常是随机的,以特定概率选择不同动作(例如,参见 Singh, Jaakkola, and Jordan, 1994)。
Second, an arbitrarily small change in the estimated value of an action can cause it to be, or not be, selected.
其次,一个动作的估计值的任意微小变化可能导致它被选中或不被选中
Such discontinuous changes have been identified as a key obstacle to establishing convergence assurances for algorithms following the value-function approach (Bertsekas and Tsitsiklis, 1996).
这种不连续变化被认为是为 遵循价值函数方法的算法 建立 收敛保证的关键障碍 (Bertsekas和Tsitsiklis, 1996)。
For example, Q-learning, Sarsa, and dynamic programming methods have all been shown unable to converge to any policy for simple MDPs and simple function approximators (Gordon, 1995, 1996; Baird, 1995; Tsitsiklis and van Roy, 1996; Bertsekas and Tsitsiklis, 1996).
例如,Q-learning、Sarsa 和动态规划方法都被证明不能收敛于简单 MDPs 和简单函数近似器的任何策略(Gordon, 1995,1996;贝尔德,1995;Tsitsiklis和van Roy, 1996;Bertsekas and Tsitsiklis, 1996)。
This can occur even if the best approximation is found at each step before changing the policy, and whether the notion of “best” is in the mean-squared-error sense or the slightly different senses of residual-gradient, temporal-difference, and dynamic-programming methods.
即使在改变策略之前的每一步都找到了最佳近似值,无论“最佳”的概念是在均方误差意义上还是在残差梯度、时序差分和动态规划方法的稍微不同的意义上,也可能发生这种情况。

In this paper we explore an alternative approach to function approximation in RL.
在本文中我们探讨了强化学习中函数近似的另一种方法
Rather than approximating a value function and using that to compute a deterministic policy, we approximate a stochastic policy directly using an independent function approximator with its own parameters.
我们不是近似一个价值函数并使用它来计算确定性策略,而是直接使用具有自己参数的独立函数近似器近似随机策略
For example, the policy might be represented by a neural network whose input is a representation of the state, whose output is action selection probabilities, and whose weights are the policy parameters.
例如,策略可能由神经网络表示,其输入是状态的表示,其输出是动作选择概率,其权重是策略参数。
Let θ \theta θ denote the vector of policy parameters and ρ \rho ρ the performance of the corresponding policy (e.g., the average reward per step).
θ \theta θ 表示策略参数的向量, ρ \rho ρ 表示相应策略的性能(例如,每一步的平均奖励)。
Then, in the policy gradient approach, the policy parameters are updated approximately proportional to the gradient:
然后,在策略梯度方法中,策略参数的更新 与 梯度 近似成正比:
  ~  
Δ θ ≈ α ∂ ρ ∂ θ            ( 1 ) \Delta \theta\approx \alpha \frac{\partial\rho}{\partial \theta}~~~~~~~~~~(1) Δθαθρ          (1)
  ~  
其中 α \alpha α 是一个正定的步长。
如果上述条件能够实现,那么通常可以保证 θ \theta θ 在性能度量 ρ \rho ρ 中收敛到局部最优策略。
与价值函数方法不同,这里 θ \theta θ 的微小变化只会导致策略和状态访问分布的微小变化。

【证明了一个结论 1 + 得到类似结论的工作+区别】

In this paper we prove that an unbiased estimate of the gradient (1) can be obtained from experience using an approximate value function satisfying certain properties.
本文证明了用满足一定性质的近似价值函数,可以从经验中得到梯度 (1) 的无偏估计。
Williams’s (1988, 1992) REINFORCE algorithm also finds an unbiased estimate of the gradient, but without the assistance of a learned value function.
Williams (1988,1992) 的 REINFORCE 算法也找到了梯度的无偏估计,但没有习得的价值函数的帮助。
REINFORCE learns much more slowly than RL methods using value functions and has received relatively little attention.
REINFORCE 比使用价值函数的强化学习方法 学得慢,并且受到的关注相对较少。
Learning a value function and using it to reduce the variance of the gradient estimate appears to be essential for rapid learning.
学习一个价值函数 并 用它来减小梯度估计的方差对于快速学习是必不可少的。
Jaakkola, Singh and Jordan (1995) proved a result very similar to ours for the special case of function approximation corresponding to tabular POMDPs. 【partially observable Markov decision problems】
Jaakkola, Singh 和 Jordan(1995) 对于表格形式的 POMDPs 对应的函数近似的特殊情况证明了与我们非常相似的结果。
Our result strengthens theirs and generalizes it to arbitrary differentiable function approximators.
我们的结果加强了他们的结论,并将其推广任意可微函数近似器
Konda and Tsitsiklis (in prep.) independently developed a very simialr result to ours.
See also Baxter and Bartlett (in prep.) and Marbach and Tsitsiklis (1998).
Konda 和 Tsitsiklis(准备中) 独立开发了与我们非常相似的结果。
参见 Baxter and Bartlett (in prep.) 和 Marbach and Tsitsiklis(1998)。

【证明了一个结论 2 + 得到类似结论的工作+区别】

Our result also suggests a way of proving the convergence of a wide variety of algorithms based on “actor-critic” or policy-iteration architectures (e.g., Barto, Sutton, and Anderson, 1983; Sutton, 1984; Kimura and Kobayashi, 1998).
我们的结果还提出了一种方法来证明基于 “actor-critic” 或 策略迭代架构的各种算法的收敛性
In this paper we take the first step in this direction by proving for the first time that a version of policy iteration with general differentiable function approximation is convergent to a locally optimal policy. 【首次】
在本文中,我们在这个方向上迈出了第一步,首次证明了具有一般可微函数近似的策略迭代 收敛于 局部最优策略。
Baird and Moore (1999) obtained a weaker but superficially similar result for their VAPS family of methods. 【Value and Policy Search (VAPS) 】 【与最近的同期类似方法 比较:区别,对方的不足】
Baird 和 Moore(1999) 在他们的 VAPS 系列方法中得到了一个较弱但表面上相似的结果。
Like policy-gradient methods, VAPS includes separately parameterized policy and value functions updated by gradient methods.
与策略梯度方法一样,VAPS 包括分别参数化的,由梯度方法更新的策略 和 价值函数。
However, VAPS methods do not climb the gradient of performance (expected long-term reward), but of a measure combining performance and value-function accuracy.
然而,VAPS 方法不是沿着性能(长期奖励期望)的梯度往上爬,而是结合性能价值函数准确性的测量。
As a result, VAPS does not converge to a locally optimal policy, except in the case that no weight is put upon value-function accuracy, in which case VAPS degenerates to REINFORCE.
因此,VAPS 不会收敛到局部最优策略,除非在不重视价值函数准确性的情况下,在这种情况下,VAPS 退化为 REINFORCE。
Similarly, Gordon’s (1995) fitted value iteration is also convergent and value-based, but does not find a locally optimal policy.
同样,Gordon(1995) 的拟合价值迭代也是收敛的,基于价值,但没有找到局部最优策略。

1 策略梯度定理

我们考虑标准强化学习框架(参见,例如,Sutton 和 Barto, 1998),其中学习代理 与 马尔可夫决策过程 (MDP) 交互。
每个时间 t ∈ { 0 , 1 , 2 , ⋯   } t\in\{0,1,2,\cdots\} t{0,1,2,} 的状态、动作和奖励分别表示 s t ∈ S s_t \in {\cal S} stS a t ∈ A a_t \in {\cal A} atA r t ∈ R r_t \in {\frak R} rtR
环境的动态表征为 状态转移概率 P s s ′ a = P r { s t + 1 = s ′ ∣ s t = s , a t = a } {\cal P}_{ss^\prime}^a=Pr\{s_{t+1} =s ' | s_t=s,a_t=a\} Pssa=Pr{st+1=sst=s,at=a},奖励期望为 R s a = E { r t + 1 ∣ s t = s , a t = a } , ∀   s , s ′ ∈ S , a ∈ A {\cal R}_s^a=E\{r_{t+1} | s_t=s,a_t=a\},\forall ~s,s^\prime\in {\cal S}, a\in {\cal A} Rsa=E{rt+1st=s,at=a} s,sS,aA
代理在每个时间的决策过程表征为策略 π ( s , a , θ ) = P r { a t = a ∣ s t = s , θ } , ∀   s ∈ S , a ∈ A π(s, a,θ) =Pr\{a_t= a|s_t =s, θ\}, \forall ~s \in {\cal S},a \in {\cal A} π(s,aθ)=Pr{at=ast=s,θ} sS,aA,其中 θ ∈ R l \theta\in{\frak R}^l θRl ,对于 l < < ∣ S ∣ l<< |\cal S| l<<S θ θ θ 是参数向量。
我们假定 π π π 对它的参数是可微的,即 ∂ π ( s , a ) ∂ θ \frac{\partial \pi(s,a)}{\partial \theta} θπ(s,a) 存在。
我们通常把 π ( s , a , θ ) π(s,a,θ) π(s,a,θ) 写成 π ( s , a ) π(s,a) π(s,a)

${\frak R}$       R ~~~~~{\frak R}      R

利用函数近似,有两种方法可以有效地描述代理的目标。
一种是平均奖励公式,其中根据每一步的长期奖励预期 ρ ( π ) ρ(π) ρ(π) 对策略进行排名:
  ~  
ρ ( π ) = lim ⁡ n → ∞ 1 n E { r 1 + r 2 + ⋯ + r n ∣ π } = ∑ s d π ( s ) ∑ a π ( s , a ) R s a ρ(π)=\lim\limits_{n\to\infty}\frac{1}{n}E\{r_1+r_2+\cdots+r_n|\pi\}=\sum\limits_sd^\pi(s)\sum\limits_a\pi(s,a){\cal R}_s^a ρ(π)=nlimn1E{r1+r2++rnπ}=sdπ(s)aπ(s,a)Rsa
  ~  
其中 d π ( s ) = lim ⁡ t → ∞ P r { s t = s ∣ s 0 , π } d^{\pi}(s) = \lim_{t→\infty}Pr\{s_t= s|s_0,\pi\} dπ(s)=limtPr{st=ss0,π} π \pi π状态的平稳分布,我们假设对所有策略都存在且独立于 s 0 s_0 s0
在平均奖励公式中,给定策略的 状态-动作对的价值定义为
  ~  
Q π ( s , a ) = ∑ t = 1 ∞ E { r t − ρ ( π ) ∣ s 0 = s , a 0 = a , π } Q^\pi(s,a)=\sum\limits_{t=1}^\infty E\{r_t-\rho(\pi)|s_0=s,a_0=a,\pi\} Qπ(s,a)=t=1E{rtρ(π)s0=s,a0=a,π}
  ~  
我们讨论的第二个公式是有一个指定的开始状态 s 0 s_0 s0 ,我们只关心从中获得的长期奖励。
我们只给出我们的结果一次,但它们在定义下也适用于这个公式
  ~  
ρ ( π ) = E { ∑ t = 1 ∞ γ t − 1 r t ∣ s 0 , π } ρ(π)=E\Big\{\sum\limits_{t=1}^{\infty}\gamma^{t-1}r_t\Big|s_0,\pi\Big\} ρ(π)=E{t=1γt1rt s0,π}
  ~  
Q π ( s , a ) = E { ∑ k = 1 ∞ γ k − 1 r t + k ∣ s t = s , a t = a , π } Q^\pi(s,a)=E\Big\{\sum\limits_{k=1}^{\infty}\gamma^{k-1}r_{t+k}\Big|s_t=s,a_t=a,\pi\Big\} Qπ(s,a)=E{k=1γk1rt+k st=s,at=a,π}
  ~  
其中, γ ∈ [ 0 , 1 ] \gamma \in [0,1] γ[0,1] 是折扣率( γ = 1 \gamma=1 γ=1 只允许出现在回合式任务中)。
在这个公式中,我们将 d π ( s ) d^\pi(s) dπ(s) 定义为从 s 0 s_0 s0 开始遇到的状态的折扣加权,然后遵循 π : d π ( s ) = ∑ t = 0 ∞ γ t P r { s t = s ∣ s 0 , π } π: d^\pi(s)=\sum_{t=0}^\infty \gamma ^t Pr \{s_t=s|s_0,\pi\} π:dπ(s)=t=0γtPr{st=ss0,π}

Our first result concerns the gradient of the performance metric with respect to the policy parameter:
我们的第一个结果涉及性能指标 相对于 策略参数的梯度:

Theorem 1 (Policy Gradient). 对于任何 MDP,无论是在平均奖励还是 启动状态公式中,
  ~  
∂ ρ ∂ θ = ∑ s d π ( s ) ∑ a ∂ π ( s , a ) ∂ θ Q π ( s , a )            ( 2 ) \frac{\partial \rho}{\partial \theta}=\sum\limits_sd^\pi(s)\sum\limits_a\frac{\partial \pi(s,a)}{\partial \theta}Q^\pi(s,a)~~~~~~~~~~(2) θρ=sdπ(s)aθπ(s,a)Qπ(s,a)          (2)
  ~  

附录的定理 1 证明:

  • 目标: 证明 ∂ ρ ∂ θ = ∑ s d π ( s ) ∑ a ∂ π ( s , a ) ∂ θ Q π ( s , a ) \frac{\partial \rho}{\partial \theta}=\sum\limits_sd^\pi(s)\sum\limits_a\frac{\partial \pi(s,a)}{\partial \theta}Q^\pi(s,a) θρ=sdπ(s)aθπ(s,a)Qπ(s,a)

我们首先证明平均奖励公式,然后证明起始状态公式。
  ~  
在这里插入图片描述

  • 类似于 抛硬币最终正面朝上和朝下这两种状态的概率分别为 0.5。

  ~  
∂ V π ( s ) ∂ θ = d e f ∂ ∂ θ ∑ a π ( s , a ) Q π ( s , a )       ∀   s ∈ S = ∑ a [ ∂ π ( s , a ) ∂ θ Q π ( s , a ) + π ( s , a ) ∂ ∂ θ Q π ( s , a ) ] = ∑ a [ ∂ π ( s , a ) ∂ θ Q π ( s , a ) + π ( s , a ) ∂ ∂ θ [ R s a − ρ ( π ) + ∑ s ′ P s s ′ a V π ( s ′ ) ] ] = ∑ a [ ∂ π ( s , a ) ∂ θ Q π ( s , a ) + π ( s , a ) [ − ∂ ρ ∂ θ + ∑ s ′ P s s ′ a ∂ V π ( s ′ ) ∂ θ ] ] \begin{aligned}\frac{\partial V^\pi(s)}{\partial \theta}&\xlongequal{def}\frac{\partial}{\partial \theta}\sum\limits_a\pi(s,a)Q^\pi(s,a)~~~~~\forall ~s\in {\cal S}\\ &=\sum\limits_a\Bigg[\frac{\partial\pi(s,a)}{\partial \theta}Q^\pi(s,a)+\pi(s,a)\frac{\partial}{\partial \theta}Q^\pi(s,a)\Bigg]\\ &=\sum\limits_a\Bigg[\frac{\partial\pi(s,a)}{\partial \theta}Q^\pi(s,a)+\pi(s,a)\frac{\partial}{\partial \theta}\Bigg[\textcolor{blue}{{\cal R}_s^a-\rho(\pi)+\sum\limits_{s^\prime}{\cal P}_{ss^\prime}^a V^\pi(s^\prime)}\Bigg]\Bigg]\\ &=\sum\limits_a\Bigg[\frac{\partial\pi(s,a)}{\partial \theta}Q^\pi(s,a)+\pi(s,a)\Bigg[\textcolor{blue}{-\frac{\partial \rho}{\partial \theta}}+\sum\limits_{s^\prime}{\cal P}_{ss^\prime}^a \frac{\partial V^\pi(s^\prime)}{\partial \theta}\Bigg]\Bigg]\end{aligned} θVπ(s)def θaπ(s,a)Qπ(s,a)      sS=a[θπ(s,a)Qπ(s,a)+π(s,a)θQπ(s,a)]=a[θπ(s,a)Qπ(s,a)+π(s,a)θ[Rsaρ(π)+sPssaVπ(s)]]=a[θπ(s,a)Qπ(s,a)+π(s,a)[θρ+sPssaθVπ(s)]]
  ~  
∂ ρ ∂ θ \frac{\partial \rho}{\partial \theta} θρ a a a 无关, ∑ a π ( s , a ) = 1 \sum\limits_a\pi(s,a)=1 aπ(s,a)=1,则
  ~  
∂ ρ ∂ θ = ∑ a [ ∂ π ( s , a ) ∂ θ Q π ( s , a ) + π ( s , a ) ∑ s ′ P s s ′ a ∂ V π ( s ′ ) ∂ θ ] − ∂ V π ( s ) ∂ θ \frac{\partial \rho}{\partial \theta}=\sum\limits_a\Bigg[\frac{\partial\pi(s,a)}{\partial \theta}Q^\pi(s,a)+\pi(s,a)\sum\limits_{s^\prime}{\cal P}_{ss^\prime}^a \frac{\partial V^\pi(s^\prime)}{\partial \theta}\Bigg]-\frac{\partial V^\pi(s)}{\partial \theta} θρ=a[θπ(s,a)Qπ(s,a)+π(s,a)sPssaθVπ(s)]θVπ(s)
  ~  
两边对平稳分布 d π d^\pi dπ 求和,
  ~  
∑ s d π ( s ) ∂ ρ ∂ θ = ∑ s d π ( s ) ∑ a ∂ π ( s , a ) ∂ θ Q π ( s , a ) + ∑ s d π ( s ) ∑ a π ( s , a ) ∑ s ′ P s s ′ a ∂ V π ( s ′ ) ∂ θ − ∑ s d π ( s ) ∂ V π ( s ) ∂ θ \sum\limits_sd^\pi(s)\frac{\partial \rho}{\partial \theta}=\sum\limits_sd^\pi(s)\sum\limits_a\frac{\partial\pi(s,a)}{\partial \theta}Q^\pi(s,a)+\sum\limits_sd^\pi(s)\sum\limits_a\pi(s,a)\sum\limits_{s^\prime}{\cal P}_{ss^\prime}^a \frac{\partial V^\pi(s^\prime)}{\partial \theta}-\sum\limits_sd^\pi(s)\frac{\partial V^\pi(s)}{\partial \theta} sdπ(s)θρ=sdπ(s)aθπ(s,a)Qπ(s,a)+sdπ(s)aπ(s,a)sPssaθVπ(s)sdπ(s)θVπ(s)
  ~  
由于 d π d^\pi dπ 是平稳的
  ~  
∑ s d π ( s ) ⏟ 1 ∂ ρ ∂ θ = ∑ s d π ( s ) ∑ a ∂ π ( s , a ) ∂ θ Q π ( s , a ) + ∑ s d π ( s ) ∑ a π ( s , a ) ∑ s ′ P s s ′ a ⏟ ∑ s ′ d π ( s ′ ) ∂ V π ( s ′ ) ∂ θ − ∑ s d π ( s ) ∂ V π ( s ) ∂ θ \underbrace{\sum\limits_sd^\pi(s)}_{\textcolor{blue}{1}}\frac{\partial \rho}{\partial \theta}=\sum\limits_sd^\pi(s)\sum\limits_a\frac{\partial\pi(s,a)}{\partial \theta}Q^\pi(s,a)+\underbrace{\sum\limits_sd^\pi(s)\sum\limits_a\pi(s,a)\sum\limits_{s^\prime}{\cal P}_{ss^\prime}^a}_{\textcolor{blue}{\sum\limits_{s^\prime}d^\pi(s^\prime)}} \frac{\partial V^\pi(s^\prime)}{\partial \theta}-\sum\limits_sd^\pi(s)\frac{\partial V^\pi(s)}{\partial \theta} 1 sdπ(s)θρ=sdπ(s)aθπ(s,a)Qπ(s,a)+sdπ(s) sdπ(s)aπ(s,a)sPssaθVπ(s)sdπ(s)θVπ(s)
  ~  
∂ ρ ∂ θ = ∑ s d π ( s ) ∑ a ∂ π ( s , a ) ∂ θ Q π ( s , a ) \frac{\partial \rho}{\partial \theta}=\sum\limits_sd^\pi(s)\sum\limits_a\frac{\partial\pi(s,a)}{\partial \theta}Q^\pi(s,a) θρ=sdπ(s)aθπ(s,a)Qπ(s,a)
  ~  
——————————————————
对于 起始状态公式
  ~  
在这里插入图片描述
  ~  
∂ V π ( s ) ∂ θ = d e f ∂ ∂ θ ∑ a π ( s , a ) Q π ( s , a )       ∀   s ∈ S = ∑ a [ ∂ π ( s , a ) ∂ θ Q π ( s , a ) + π ( s , a ) ∂ ∂ θ Q π ( s , a ) ] = ∑ a [ ∂ π ( s , a ) ∂ θ Q π ( s , a ) + π ( s , a ) ∂ ∂ θ [ R s a + ∑ s ′ γ P s s ′ a V π ( s ′ ) ] ] = ∑ a [ ∂ π ( s , a ) ∂ θ Q π ( s , a ) + π ( s , a ) ∑ s ′ γ P s s ′ a ∂ V π ( s ′ ) ∂ θ ]              ( 7 ) = ∑ x ∑ k = 0 ∞ γ k P r ( s → x , k , π ) ∑ a ∂ π ( x , a ) ∂ θ Q π ( x , a )         ? ? ? ? \begin{aligned}\frac{\partial V^\pi(s)}{\partial \theta}&\xlongequal{def}\frac{\partial}{\partial \theta}\sum\limits_a\pi(s,a)Q^\pi(s,a)~~~~~\forall ~s\in {\cal S}\\ &=\sum\limits_a\Bigg[\frac{\partial\pi(s,a)}{\partial \theta}Q^\pi(s,a)+\pi(s,a)\frac{\partial}{\partial \theta}Q^\pi(s,a)\Bigg]\\ &=\sum\limits_a\Bigg[\frac{\partial\pi(s,a)}{\partial \theta}Q^\pi(s,a)+\pi(s,a)\frac{\partial}{\partial \theta}\Bigg[{\cal R}_s^a+\sum\limits_{s^\prime}\textcolor{blue}{\gamma}{\cal P}_{ss^\prime}^a V^\pi(s^\prime)\Bigg]\Bigg]\\ &=\sum\limits_a\Bigg[\frac{\partial\pi(s,a)}{\partial \theta}Q^\pi(s,a)+\pi(s,a)\sum\limits_{s^\prime}\gamma{\cal P}_{ss^\prime}^a \frac{\partial V^\pi(s^\prime)}{\partial \theta}\Bigg]~~~~~~~~~~~~(7)\\ &= \sum\limits_x\sum\limits_{k=0}^\infty\gamma^k Pr(s\to x,k,\pi)\sum\limits_a \frac{\partial\pi(x,a)}{\partial \theta}Q^\pi(x,a)~~~~~~~\textcolor{blue}{????}\end{aligned} θVπ(s)def θaπ(s,a)Qπ(s,a)      sS=a[θπ(s,a)Qπ(s,a)+π(s,a)θQπ(s,a)]=a[θπ(s,a)Qπ(s,a)+π(s,a)θ[Rsa+sγPssaVπ(s)]]=a[θπ(s,a)Qπ(s,a)+π(s,a)sγPssaθVπ(s)]            (7)=xk=0γkPr(sx,k,π)aθπ(x,a)Qπ(x,a)       ????
  ~  
对 (7) 展开几步,其中 P r ( s → x , k , π ) Pr(s→x, k,\pi) Pr(sx,k,π) 是策略 π π π k k k 步内从状态 s s s 到状态 x x x 的概率。
直接得到
  ~  
∂ ρ ∂ θ = ∂ ∂ θ E { ∑ t = 1 ∞ γ t − 1 r t ∣ s 0 , π } = ∂ ∂ θ V π ( s 0 ) = ∑ s ∑ k = 0 ∞ γ k P r ( s 0 → s , k , π ) ∑ a ∂ π ( s , a ) ∂ θ Q π ( s , a ) = ∑ s d π ( s ) ∑ a ∂ π ( s , a ) ∂ θ Q π ( s , a ) \begin{aligned}\frac{\partial \textcolor{blue}{\rho}}{\partial \theta}&=\frac{\partial}{\partial \theta}E\Big\{\sum\limits_{t=1}^\infty\gamma^{t-1}r_t\Big|s_0,\pi\Big\}=\frac{\partial}{\partial \theta}\textcolor{blue}{V^\pi(s_0)}\\ &=\sum\limits_s\sum\limits_{k=0}^\infty\gamma^k Pr(s_0\to s,k,\pi)\sum\limits_a \frac{\partial\pi(s,a)}{\partial \theta}Q^\pi(s,a)\\ &=\sum\limits_sd^\pi(s)\sum\limits_a \frac{\partial\pi(s,a)}{\partial \theta}Q^\pi(s,a)\end{aligned} θρ=θE{t=1γt1rt s0,π}=θVπ(s0)=sk=0γkPr(s0s,k,π)aθπ(s,a)Qπ(s,a)=sdπ(s)aθπ(s,a)Qπ(s,a)
证毕。

Marbach 和 Tsitsiklis(1998) 基于 Jaakkola、Singh 和Jordan(1995) 以及 Cao 和 Chen(1997) 提出的 状态-价值函数的相关表达式,在平均奖励公式中首次讨论了这种表达梯度的方式。
我们将他们的结果推广到起始状态公式,并提供了更简单、更直接的证明
Williams(1988,1992) 的 REINFORCE 算法理论也可以被视为暗示 (2)。
无论如何,梯度的两个表达式的关键方面是它们都不是 ∂ d π ( s ) ∂ θ \frac{\partial d^\pi(s)}{\partial \theta} θdπ(s) 形式的项:策略变化对状态分布的影响没有出现。
这便于通过抽样来近似梯度
例如,如果 s s s 是从遵循 π π π 得到的分布中抽样,那么 ∑ a ∂ π ( s , a ) ∂ θ Q π ( s , a ) \sum_a\frac{\partial \pi(s,a)}{\partial \theta}Q^\pi(s,a) aθπ(s,a)Qπ(s,a) 将是 ∂ ρ ∂ θ \frac{\partial \rho}{\partial \theta} θρ 的无偏估计。
当然, Q π ( s , a ) Q^\pi(s, a) Qπ(s,a) 通常也是未知的,必须进行估计。
一种方法是使用实际回报 R t = ∑ k = 1 ∞ r t + k − ρ ( π ) R_t=\sum\limits_{k=1}^\infty r_{t+k}-\rho(π) Rt=k=1rt+kρ(π) (或 R t = ∑ k = 1 ∞ γ k − 1 r t + k R_t=\sum\limits_{k=1}^\infty\gamma^{k-1}r_{t+k} Rt=k=1γk1rt+k ,初始状态公式)作为每个 Q π ( s t , a t ) Q^\pi(s_t, a_t) Qπ(st,at) 的近似值。
这得到 Williams 的回合式 REINFORCE 算法 Δ θ t ∝ ∂ π ( s t , a t ) ∂ θ R t 1 π ( s t , a t ) Δθ_t\propto \frac{\partial \pi(s_t,a_t)}{\partial \theta}R_t\frac{1}{\pi(s_t,a_t)} Δθtθπ(st,at)Rtπ(st,at)1 ( 1 π ( s t , a t ) \frac{1}{\pi(s_t,a_t)} π(st,at)1 纠正了 π \pi π 偏好的动作的过采样),已知其期望值遵循 ∂ ρ ∂ θ \frac{\partial \rho}{\partial \theta} θρ(Williams, 1988, 1992)。

2 策略梯度 近似

现在考虑用一个习得的函数近似器来近似 Q π Q^\pi Qπ 的情况。
如果近似足够好,我们可能希望用它来代替 (2) 中的 Q π Q^\pi Qπ 且仍然大致指向梯度的方向。
For example, Jaakkola, Singh, and Jordan (1995) proved that for the special case of function approximation arising in a tabular POMDP one could assure positive inner product with the gradient, which is sufficient to ensure improvement for moving in that direction.
例如,Jaakkola, Singh, and Jordan(1995) 证明,对于表格形式 POMDP 【部分可观察 MDP】中产生的函数近似的特殊情况,可以保证与梯度的正内积,这足以保证在该方向上移动的改进。
Here we extend their result to general function approximation and prove equality with the gradient.
本文将其结果推广到一般函数近似,并证明与梯度相等。

f w : S × A → R f_w:{\cal S} \times {\cal A}→{\frak R} fw:S×AR 是我们对 Q π Q^\pi Qπ 的近似值,参数为 w w w
很自然地,我们可以这样学习 f w f_w fw:遵循 π \pi π,通过以下规则更新 w w w △ w t ∝ ∂ ∂ w [ Q ^ π ( s t , a t ) − f w ( s t , a t ) ] 2 ∝ [ Q ^ π ( s t , a t ) − f w ( s t , a t ) ] ∂ f w ( s t , a t ) ∂ w △w_t \propto \frac{\partial}{\partial w}[\hat Q^\pi(s_t,a_t) -f_w(s_t,a_t)] ^2 \propto [\hat Q^\pi(s_t,a_t) -f_w(s_t,a_t)]\frac{\partial f_w(s_t,a_t)}{\partial w} wtw[Q^π(st,at)fw(st,at)]2[Q^π(st,at)fw(st,at)]wfw(st,at),其中 Q ^ π ( s t , a t ) \hat Q^\pi(s_t,a_t) Q^π(st,at) Q π ( s t , a t ) Q^\pi(s_t,a_t) Qπ(st,at)的某个无偏估计量,可能是 R t R_t Rt
当此过程收敛到局部最优时,则
  ~  
∑ s d π ( s ) ∑ a π ( s , a ) [ Q π ( s , a ) − f w ( s , a ) ] ∂ f w ( s , a ) ∂ w = 0            ( 3 ) \sum\limits_s d^\pi(s)\sum\limits_a\pi(s,a)[Q^\pi(s,a)-f_w(s,a)]\frac{\partial f_w(s,a)}{\partial w}=0~~~~~~~~~~(3) sdπ(s)aπ(s,a)[Qπ(s,a)fw(s,a)]wfw(s,a)=0          (3)

Theorem 2 (Policy Gradient with Function Approximation). 如果 f w f_w fw 满足 (3) 且 策略参数化是兼容的,即满足等式
  ~  
∂ f w ( s , a ) ∂ w = ∂ π ( s , a ) ∂ θ 1 π ( s , a )            ( 4 ) \frac{\partial f_w(s,a)}{\partial \textcolor{blue}{w}}=\frac{\partial \pi(s,a)}{\partial \textcolor{blue}{\theta}}\frac{1}{\pi(s,a)}~~~~~~~~~~(4) wfw(s,a)=θπ(s,a)π(s,a)1          (4)
  ~  

  ~  
∂ ρ ∂ θ = ∑ a d π ( s ) ∑ a ∂ π ( s , a ) ∂ θ f w ( s , a )            ( 5 ) \frac{\partial \rho}{\partial \theta}=\sum\limits_ad^\pi(s)\sum\limits_a\frac{\partial \pi(s,a)}{\partial \theta}f_w(s,a)~~~~~~~~~~(5) θρ=adπ(s)aθπ(s,a)fw(s,a)          (5)
  ~  

  • 1 Tsitsiklis (个人交流) 指出, f w f_w fw 右侧给出的特征是线性的,这可能是满足这个条件的唯一途径

证明:

  • 目标: 证明 ∂ ρ ∂ θ = ∑ a d π ( s ) ∑ a ∂ π ( s , a ) ∂ θ f w ( s , a ) \frac{\partial \rho}{\partial \theta}=\sum\limits_ad^\pi(s)\sum\limits_a\frac{\partial \pi(s,a)}{\partial \theta}f_w(s,a) θρ=adπ(s)aθπ(s,a)fw(s,a)

联立 (3) 和 (4) 得
  ~  
∑ s d π ( s ) ∑ a ∂ π ( s , a ) ∂ θ [ Q π ( s , a ) − f w ( s , a ) ] = 0            ( 6 )       \sum\limits_s d^\pi(s)\sum\limits_a\frac{\partial \pi(s,a)}{\partial \theta}[Q^\pi(s,a)-f_w(s,a)]=0~~~~~~~~~~(6)~~~~~ sdπ(s)aθπ(s,a)[Qπ(s,a)fw(s,a)]=0          (6)     将 (4) 代入 (3), π ( s , a ) \pi(s,a) π(s,a) 消掉
  ~  
这告诉我们 f w ( s , a ) f_w(s,a) fw(s,a) 中的误差策略参数化的梯度正交。
由于上面的表达式为零,我们可以从策略梯度定理 (2) 中减去它,得到
  ~  
∂ ρ ∂ θ = ∑ s d π ( s ) ∑ a ∂ π ( s , a ) ∂ θ Q π ( s , a ) ⏟ 定理  2 − ∑ s d π ( s ) ∑ a ∂ π ( s , a ) ∂ θ [ Q π ( s , a ) − f w ( s , a ) ] ⏟ 式  ( 6 ) ,等于  0 = ∑ s d π ( s ) ∑ a ∂ π ( s , a ) ∂ θ [ Q π ( s , a ) − Q π ( s , a ) + f w ( s , a ) ] = ∑ s d π ( s ) ∑ a ∂ π ( s , a ) ∂ θ f w ( s , a ) \begin{aligned}&\underbrace{\frac{\partial \rho}{\partial \theta}=\sum\limits_sd^\pi(s)\sum\limits_a\frac{\partial \pi(s,a)}{\partial \theta}Q^\pi(s,a)}_{定理~ 2}-\underbrace{\sum\limits_s d^\pi(s)\sum\limits_a\frac{\partial \pi(s,a)}{\partial \theta}[Q^\pi(s,a)-f_w(s,a)]}_{式~(6),等于 ~0}\\ &=\sum\limits_sd^\pi(s)\sum\limits_a\frac{\partial \pi(s,a)}{\partial \theta}\Big[Q^\pi(s,a)-Q^\pi(s,a)+f_w(s,a)\Big]\\ &=\sum\limits_sd^\pi(s)\sum\limits_a\frac{\partial \pi(s,a)}{\partial \theta}f_w(s,a)\end{aligned} 定理 2 θρ=sdπ(s)aθπ(s,a)Qπ(s,a) (6),等于 0 sdπ(s)aθπ(s,a)[Qπ(s,a)fw(s,a)]=sdπ(s)aθπ(s,a)[Qπ(s,a)Qπ(s,a)+fw(s,a)]=sdπ(s)aθπ(s,a)fw(s,a)
证毕。

3 推导算法 和 优势的应用

Given a policy parameterization, Theorem 2 can be used to derive an appropriate form for the value-function parameterization.
给定策略参数化,定理 2 可用于推导价值函数参数化的适当形式。
For example, consider a policy that is a Gibbs distribution in a linear combination of features:
例如,考虑一个策略,它是特征线性组合的吉布斯分布:
  ~  
π ( s , a ) = e θ T ϕ s a ∑ b e θ T ϕ s b         ∀   s ∈ S , a ∈ A \pi(s,a)=\frac{e^{\theta^T\phi_{sa}}}{\sum_be^{\theta^T\phi_{sb}}}~~~~~~~\forall~s\in{\cal S},a\in{\cal A} π(s,a)=beθTϕsbeθTϕsa        sS,aA
  ~  
其中每个 ϕ s a \phi_{sa} ϕsa 是表征 状态-动作对 s , a s, a s,a l l l 维特征向量。满足兼容性条件 (4) 要求
  ~  
∂ f w ( s , a ) ∂ w = ∂ π ( s , a ) ∂ θ 1 π ( s , a ) = ϕ s a − ∑ b π ( s , b ) ϕ s b \frac{\partial f_w(s,a)}{\partial w}=\frac{\partial \pi(s,a)}{\partial \theta}\frac{1}{\pi(s,a)}=\phi_{sa}-\sum\limits_b\pi(s,b)\phi_{sb} wfw(s,a)=θπ(s,a)π(s,a)1=ϕsabπ(s,b)ϕsb
  ~  
所以 f w f_w fw 的自然参数化是
  ~  
f w ( s , a ) = w T [ ϕ s a − ∑ b π ( s , a ) ϕ s b ] f_w(s,a)=w^T\Big[\phi_{sa}-\sum\limits_b\pi(s,a)\phi_{sb}\Big] fw(s,a)=wT[ϕsabπ(s,a)ϕsb]
  ~  
换句话说, f w f_w fw与策略相同的特征上必须是线性的,除了标准化为每个状态的平均值为零。
对于各种非线性策略参数化,例如多层反向传播网络,可以很容易地推导出其他算法。

细心的读者会注意到,上面给出的 f w f_w fw 的形式要求它对每个状态都有零平均值 ∑ a π ( s , a ) f w ( s , a ) = 0 , ∀   s ∈ S \sum_a\pi(s,a)f_w(s,a) = 0, \forall ~s \in {\cal S} aπ(s,a)fw(s,a)=0, sS
在这个意义上,最好把 f w f_w fw 看作是优势函数 A π ( s , a ) = Q π ( s , a ) − V π ( s ) A^\pi(s,a) = Q^\pi(s,a)-V^\pi(s) Aπ(s,a)=Qπ(s,a)Vπ(s) 的近似值(很像Baird, 1993),而不是 Q π Q^\pi Qπ 的近似值。
我们的收敛要求 (3) 实际上 f w f_w fw 是我们在每个状态下得到正确的动作的相对值,而不是绝对值,也不是状态之间的变化。
我们的结果可以看作是以优势作为 RL 中价值函数近似 目标的特殊地位的证明。
实际上,我们的 (2)、(3) 和 (5) 都可以推广到包含任意状态函数添加到价值函数或其近似值中。
例如,(5) 可推广为 ∂ ρ ∂ θ = ∑ s d π ( s ) ∑ a ∂ π ( s , a ) ∂ θ [ f w ( s , a ) + v ( s , a ) ] \frac{\partial \rho}{\partial \theta}=\sum_sd^\pi(s)\sum_a\frac{\partial \pi(s,a)}{\partial \theta}[f_w(s,a)+v(s,a)] θρ=sdπ(s)aθπ(s,a)[fw(s,a)+v(s,a)], 其中 v : S → R v:{\cal S\to{\frak R}} v:SR 是一个任意函数。
( 这个成立是因为 ∑ a ∂ π ( s , a ) ∂ θ = 0 ,    ∀   s ∈ S \sum_a\frac{\partial \pi(s,a)}{\partial \theta}=0,~~\forall~s\in{\cal S} aθπ(s,a)=0,   sS ) v v v 的选择不影响我们的任何定理,但可以实质上影响梯度估计量的方差
这里的问题完全类似于早期工作中使用强化基线的问题(例如,Williams, 1992; Dayan, 1991; Sutton, 1984).。
实际上, v v v 应该被设为 V π V^\pi Vπ 的最佳近似
我们的结果表明,该近似过程可以在不影响 f w f_w fw π π π 的预期演化的情况下进行。

4 函数近似的策略梯度的收敛性

Given Theorem 2, we can prove for the first time that a form of policy iteration withfunction approximation is convergent to a locally optimal policy.
给定定理 2,我们首次证明了一种带函数近似的策略迭代 收敛于 局部最优策略。

Theorem 3 (Policy Iteration with Function Approximation).
定理 3 (函数近似的策略迭代)。
π \pi π f w f_w fw 分别为 策略 和 价值函数满足相容条件 (4) 且满足 max ⁡   θ , s , a , i , j ∣ ∂ 2 π ( s , a ) ∂ θ i ∂ θ j ∣ < B < ∞ \max_{~\theta,s,a,i,j}|\frac{\partial ^2\pi(s,a)}{\partial\theta_i\partial \theta_j}|<B < \infty max θ,s,a,i,jθiθj2π(s,a)<B< 的任意可微函数近似器,
{ α k } k = 0 ∞ \{\alpha_k\}_{k=0}^\infty {αk}k=0 为任意步长序列,使得 lim ⁡ k → ∞ α k = 0 \lim_{k \to \infty}\alpha_k=0 limkαk=0 ∑ k α k = ∞ \sum_k\alpha_k=\infty kαk=
然后,对于任何有界奖励的 MDP,序列 { ρ ( π k ) } k = 0 ∞ \{\rho(\pi_k) \}_{k=0}^\infty {ρ(πk)}k=0,定义为任意 θ 0 , π k = π ( ⋅ , ⋅ , θ k ) θ_0,\pi_k=\pi(·,·,\theta_k) θ0,πk=π(⋅,⋅,θk)
  ~  
w k = w w_k=w wk=w 使得 ∑ s d π k ( s ) ∑ a π k ( s , a ) [ Q π k ( s , a ) − f w ( s , a ) ] ∂ f w ( s , a ) ∂ w = 0            \sum\limits_s d^{\pi_k}(s)\sum\limits_a\pi_k(s,a)[Q^{\pi_k}(s,a)-f_w(s,a)]\frac{\partial f_w(s,a)}{\partial w}=0~~~~~~~~~~ sdπk(s)aπk(s,a)[Qπk(s,a)fw(s,a)]wfw(s,a)=0          式 (3) 的 π \pi π 替换成 π k \pi_k πk
  ~  
θ k + 1 = θ k + α k ∑ a d π k ( s ) ∑ a ∂ π k ( s , a ) ∂ θ f w k ( s , a ) ⏟ 式  ( 5 ) 的  ∂ ρ ∂ θ , π  替换成  π k            ( 5 ) \theta_{k+1}=\theta_k+\alpha_k\underbrace{\sum\limits_ad^{\pi_k}(s)\sum\limits_a\frac{\partial {\pi_k}(s,a)}{\partial \theta}f_{w_k}(s,a)}_{式~(5) 的 ~\frac{\partial \rho}{\partial \theta},\pi~ 替换成 ~{\pi_k}}~~~~~~~~~~(5) θk+1=θk+αk (5) θρπ 替换成 πk adπk(s)aθπk(s,a)fwk(s,a)          (5)
  ~  
收敛使得 lim ⁡ k → ∞ ∂ ρ ( π k ) ∂ θ = 0 \lim_{k\to\infty}\frac{\partial \rho(\pi_k)}{\partial \theta}=0 limkθρ(πk)=0

证明:???
我们的定理 2 保证 θ k \theta_k θk 更新是在梯度方向上。
在, ∂ 2 π ( s , a ) ∂ θ i ∂ θ j \frac{\partial ^2\pi(s,a)}{\partial\theta_i\partial \theta_j} θiθj2π(s,a) 和 MDP 的奖励上的界限共同保证了 ∂ 2 ρ ∂ θ i ∂ θ j \frac{\partial ^2\rho}{\partial\theta_i\partial \theta_j} θiθj2ρ 也是有界的。
这些与步长要求一起,是适用 Bertsekas 和 Tsitsiklis (1996) 第 96 页的命题 3.5 的必要条件,该命题确保收敛到局部最优。
Proposition 3.5

Bertsekas, D. P., Tsitsiklis, J. N. (1996). Neuro-Dynamic Programming. Athena Scientific.

  • 这个资料没找到

无关的资料

  • https://www.vfu.bg/en/e-Learning/Math–Bertsekas_Tsitsiklis_Introduction_to_probability.pdf

致谢

The authors wish to thank Martha Steenstrup and Doina Precup for comments, and Michael Kearns for insights into the notion of optimal policy under function approximation.
作者希望感谢 Martha Steenstrup 和 Doina preup 的评论,以及 Michael Kearns 对函数近似下最优策略概念的见解。

参考文献

附录: 定理 1 的证明

已插入相应位置

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2168684.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Arthas jad(字节码文件反编译成源代码 )

文章目录 二、命令列表2.2 class/classloader相关命令2.2.1 jad&#xff08;字节码文件反编译成源代码 &#xff09;举例1&#xff1a;反编译指定的函数 &#xff1a;jad com.hero.lte.ems.sysmanager.cache.SMTaskCache executeTask举例2&#xff1a;反编绎时只显示源代码&…

PCIe扫盲(14)

系列文章目录 PCIe扫盲&#xff08;一&#xff09; PCIe扫盲&#xff08;二&#xff09; PCIe扫盲&#xff08;三&#xff09; PCIe扫盲&#xff08;四&#xff09; PCIe扫盲&#xff08;五&#xff09; PCIe扫盲&#xff08;六&#xff09; PCIe扫盲&#xff08;七&#xff09…

如何查看电脑的虚拟内存信息?

1、按下键盘的 win R 键 &#xff0c; 输入&#xff1a;cmd &#xff0c; 然后按下【回车】 2、在弹出的窗口输入&#xff1a;systeminfo &#xff0c; 然后按下【回车】&#xff0c;等待加载结果出来。 3、如下位置&#xff0c;显示的即是当前电脑的【虚拟内存】信息&…

Fusion Access

1.FA桌面云需要微软三剑客 2.AD&#xff0c;DNS&#xff0c;DHCP合并部署在一台虚机&#xff0c;内存配置8G 3.FA各个组件 3.1终端接入 3.2接入和访问控制层 3.3虚拟桌面管理层-桌面云规划及部署 3.4安装Linux基础架构虚拟机FA01 3.4.1安装Tools 3.4.2安装FusionAccess组件&am…

希捷电脑硬盘好恢复数据吗?探讨可能性、方法以及注意事项

在数字化时代&#xff0c;数据已成为我们生活和工作中不可或缺的一部分。希捷电脑硬盘作为数据存储的重要设备&#xff0c;承载着大量的个人文件、工作资料以及珍贵回忆。然而&#xff0c;面对硬盘故障或误操作导致的数据丢失&#xff0c;许多用户不禁要问&#xff1a;希捷电脑…

找到你的工具!5款免费可视化报表工具对比分析

选择合适的可视化工具对于分析和展示数据至关重要&#xff0c;以下是五款免费的可视化工具&#xff0c;它们各具特色&#xff0c;能够适应各种需求。本文将介绍每款工具的优势与不足&#xff0c;帮助你找到最合适的解决方案。 1. 山海鲸可视化 介绍&#xff1a;山海鲸可视化是…

UniApp组件与微信小程序组件对照学习

UniApp只是一个第三方的开发工具&#xff0c;借鉴各种平台的能力&#xff0c;UniApp的组件也借鉴了微信小程序的组件&#xff0c;我们学习时&#xff0c;可以进行对照学习&#xff0c;我们在用UniApp开发微信小程序时&#xff0c;UniApp也只是将代码转成了微信小程序的代码&…

“电瓶车火灾”频发,如何防范自救

1.概述 近年来&#xff0c;随着电动自行车使用的普及化&#xff0c;由此引发的起火事故频繁发生。作为上海市烧伤急救中心&#xff0c;上海交通大学医学院附属瑞金医院的灼伤整形科收治的此类病人数量也在逐年上升。电动自行车&#xff0c;已经成为一种新型火灾事故的“肇事者…

【Docker】02-数据卷

1. 数据卷 数据卷(volume) 是一个虚拟目录&#xff0c;是容器内目录与宿主机目录之间映射的桥梁。 2. 常见命令 docker volume createdocker volume lsdocker volume rmdocker volume inspect 查看某个数据卷的详情docker volume prune 清除数据卷 **数据卷挂载&#xff1a…

【笔记】数据结构|链表算法总结|快慢指针场景和解决方案|链表归并算法和插入算法|2012 42

受堆积现象直接影响的是&#xff1a;平均查找长度 产生堆积现象&#xff0c;即产生了冲突&#xff0c;它对存储效率、散列函数和装填因子均不会有影响&#xff0c;而平均查找长度会因为堆积现象而增大。 2012 42 参考灰灰考研 假定采用带头结点的单链表保存单词&#xff0c;当…

MySQL_表_进阶(1/2)

我们的进阶篇中&#xff0c;还是借四张表&#xff0c;来学习接下来最后关于表的需求&#xff0c;以此完成对表的基本学习。 照例给出四张表&#xff1a; 学院表&#xff1a;(testdb.dept) 课程表&#xff1a;(testdb.course) 选课表:&#xff08;testdb.sc&#xff09; 学生表…

JS面试真题 part7

JS面试真题 part7 31、web常见的攻击方式有哪些&#xff1f;如何防御32、说说JavaScript中内存泄漏的几种情况33、JavaScript如何实现继承34、说说JavaScript数字精度丢失的问题&#xff0c;如何解决35、举例说明你对尾递归的理解&#xff0c;有哪些应用场景 31、web常见的攻击…

使用kaggle命令下载数据集和模型

点击用户头像&#xff0c;点击Settings&#xff1a; 找到API&#xff0c;点击create new token&#xff0c;将自动下载kaggle.json&#xff1a; 在用户目录下创建.kaggle文件夹&#xff0c;并将下载的kaggle.json文件移动到该文件夹&#xff1a; cd ~ mv Downloads/kaggle.j…

Universal Link配置不再困扰,Xinstall来帮忙

在移动互联网时代&#xff0c;App的推广和运营至关重要。而Universal Link作为一种能够实现网页与App间无缝跳转的技术&#xff0c;对于提升用户体验、引流至App具有显著效果。今天&#xff0c;我们就来科普一下Universal Link的配置方法&#xff0c;并介绍如何通过Xinstall这款…

2024-2025华为ICT大赛报名|赛前辅导|学习资料

华为ICT大赛是华为公司打造的面向全球高校的年度ICT赛事&#xff0c;大赛以“联接、荣耀、未来”为主题&#xff0c;协同政府、高等教育机构、培训机构和行业企业&#xff0c;促进高校ICT人才培养、成长和就业&#xff0c;助力ICT人才生态繁荣。2021年3月&#xff0c;大赛成功入…

Linux Centos7达梦8数据库安装说明(附安装包,超详细图文!)收藏这一篇就够了!

VMWare17&Linux Centos7&达梦数据库8.4 使用说明 1.导语 1.1说明文档编写思路 小伙伴们,在自己电脑上搞起来啊&#xff0c;随便安装Linux环境&#xff0c;也不用担心搞错配置搞坏环境&#xff0c;大不了重装Linux系统。hahahhhhhhhhhh 由于本地没有合适的Linux环境进行…

AIGAME平台的由来与未来展望 —— 蒙特加密基金推动区块链与AI融合创新

摘要&#xff1a; AIGAME平台凭借蒙特加密产业基金的战略投资&#xff0c;成为区块链与AI融合创新的先驱。该平台集成了链游、DeFi、加密聊天和跨境支付等多项功能&#xff0c;打造出一个多元化的Web3生态系统。未来&#xff0c;AIGAME将在技术创新和全球布局中持续引领潮流。 …

JavaScript 学习

一、输出 为方便调试可以输出内容&#xff0c;但是用户是看不到的。要在开发者模式中看。 console . log ( "Hello" )&#xff1b; 二、外部文件引用 可以直接在html中写JS <head> <meta charset"utf-8"> <script> console.log("he…

微服务——服务保护(Sentinel)(一)

1.雪崩问题 级联失败或雪崩问题指的是在微服务架构中&#xff0c;由于服务间的相互依赖和调用&#xff0c;当一个服务出现故障时&#xff0c;会引起调用它的服务也出现故障&#xff0c;进而引发整个调用链路的多个服务都出现故障&#xff0c;最终导致整个系统崩溃的现象。 产生…

Redis配置文件详解(上)

一、Redis的核心配置文件 redis.conf是redis的核心配置文件&#xff0c;位于redis解压后目录的根目录&#xff0c;配置文件的内容根据不同的功能划分为多个模块。redis的注释信息写得也是非常详细的&#xff0c;以下是对部分重要得配置做简单的分析 二、基础配置信息 这部分…