2.4 理解指数加权平均数(Understanding exponentially weighted averages )

指数加权平均公式的一般形式:

Vt=βVt1+(1β)θt=(1β)θt+(1β)βθt1+(1β)β2θt2++(1β)βt1θ1+βtV0\begin{aligned}V_t =&\beta V_{t-1}+(1-\beta)\theta_t\\ =&(1-\beta)\theta_t+(1-\beta)\cdot\beta\cdot\theta_{t-1}+(1-\beta)\cdot \beta^2\cdot\theta_{t-2}+\cdots +(1-\beta)\cdot \beta^{t-1}\cdot \theta_1+\beta^t\cdot V_0 \end{aligned}

θt,θt1,θt2,,θ1\theta_t,\theta_{t-1},\theta_{t-2},\cdots,\theta_1是原始数据值,(1β),(1β)β,(1β)β2,(1-\beta),(1-\beta)\beta,(1-\beta)\beta^2,,(1β)βt1\cdots,(1-\beta)\beta^{t-1}是类似指数曲线,从右向左,呈指数下降的。VtV_t 的值是这两个子式的点乘,将原始数据值与衰减指数点乘,相当于做了指数衰减,离得越近,影响越大,离得越远,影响越小,衰减越厉害

为了减少内存的使用,使用这样的语句来实现指数加权平均算法:

Vθ=0V_{\theta}=0
Repeat {Repeat\ \{
    Get next θt\ \ \ \ Get\ next\ \theta_t
    Vθ:=βVθ+(1β)θt\ \ \ \ V_{\theta}:=\beta V_{\theta}+(1-\beta)\theta_t
}\}

Last updated