DQN算法的时间复杂度分析

Posted 白水baishui

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DQN算法的时间复杂度分析相关的知识,希望对你有一定的参考价值。

DQN算法的算法流程如下:
在这里插入图片描述时间复杂度:
设:

Initialize replay memory D \\mathcal{D} D to capacity N N N (运行消耗 t 0 t_0 t0时间)
Initialize action-value function Q Q Q with random weights (运行消耗 t 1 t_1 t1时间)
for e p i s o d e = 1 , M episode=1,M episode=1,M do (运行一次平均消耗 t 2 t_{2} t2时间,重复运行 M M M次)
\\qquad Initialise sequence s 1 = x 1 s_1={x_1} s1=x1 and preprocessed sequenced ϕ 1 = ϕ ( s 1 ) \\phi_1=\\phi(s_1) ϕ1=ϕ(s1) (运行一次平均消耗 t 2.1 t_{2.1} t2.1时间)
\\qquad for t = 1 , T t=1,T t=1,T do (运行一次平均消耗 t 2.2 t_{2.2} t2.2时间,重复运行 T T T次)
\\qquad\\qquad With probability ϵ \\epsilon ϵ select a random action a t a_t at (运行一次平均消耗 t 2.2.1 t_{2.2.1} t2.2.1时间)
\\qquad\\qquad otherwise select a t = max ⁡ a Q ∗ ( ϕ ( s t ) , a ; θ ) a_t=\\max_aQ^*(\\phi(s_t),a;\\theta) at=maxaQ(ϕ(st),a;θ) (运行一次平均消耗 t 2.2.1 t_{2.2.1} t2.2.1时间,因为是otherwise)
\\qquad\\qquad Execute action a t a_t at in emulator and observe reward r t r_t rt and image x t + 1 x_{t+1} xt+1 (运行一次平均消耗 t 2.2.2 t_{2.2.2} t2.2.2时间)
\\qquad\\qquad Set s t + 1 = s t , a t , x t + 1 s_{t+1}=s_t,a_t,x_{t+1} st+1=st,at,xt+1 and preprocess ϕ t + 1 = ϕ ( s t + 1 ) \\phi_{t+1}=\\phi(s_{t+1}) ϕt+1=ϕ(st+1) (运行一次平均消耗 t 2.2.3 t_{2.2.3} t2.2.3时间)
\\qquad\\qquad Store transition ( ϕ t , a t , r t , ϕ t + 1 ) (\\phi_t,a_t,r_t,\\phi_{t+1}) (ϕt,at,rt,ϕt+1) in D \\mathcal{D} D (运行一次平均消耗 t 2.2.4 t_{2.2.4} t2.2.4时间)
\\qquad\\qquad Sample random minibatch of transitions ( ϕ j , a j , r j , ϕ j + 1 ) (\\phi_j,a_j,r_j,\\phi_{j+1}) (ϕj,aj,rj,ϕj+1) (运行一次平均消耗 t 2.2.5 t_{2.2.5} t2.2.5时间)
Set y j = { r j , for terminal  ϕ j + 1 r j + γ max ⁡ a ′ Q ( ϕ j + 1 , a ′ ; θ ) , for non-terminal  ϕ j + 1 (运行一次平均消耗 t 2.2.6 时间) \\text{Set}\\quad y_j=\\begin{cases}r_j, & \\text{for terminal $\\phi_{j+1}$} \\\\ r_j+\\gamma\\max_{a'}Q(\\phi_{j+1},a';\\theta), & \\text{for non-terminal $\\phi_{j+1}$}\\end{cases}\\text{(运行一次平均消耗$t_{2.2.6}$时间)} Setyj={rj,rj+γmaxaQ(ϕj+1,a;θ),for terminal ϕj+1for non-terminal ϕj+1(运行一次平均消耗t2.2.6时间)
\\qquad\\qquad Perform a gradient descent step on ( y j − Q ( ϕ j , a j ; θ ) ) 2 (y_j-Q(\\phi_j,a_j;\\theta))^2 (yjQ(ϕj,aj;θ))2 according to equation 3 (运行一次平均消耗 t

以上是关于DQN算法的时间复杂度分析的主要内容,如果未能解决你的问题,请参考以下文章

复杂度分析(上):如何分析统计算法的执行效率和资源消耗

算法时间复杂度分析基础

算法--02---时间空间复杂度

实际案例4个测试学习算法的时间复杂度分析

复杂度分析(上)如何分析统计算法的执行效率和资源消耗

算法分析----第一节