# 2.4 理解指数加权平均数（Understanding exponentially weighted averages ）

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

$$
\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}
$$

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

![](/files/-Le0cdN6vVwXGqX0BR8A)

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

$$
V\_{\theta}=0
$$

$$
Repeat\ {
$$

$$
\ \ \ \ Get\ next\ \theta\_t
$$

$$
\ \ \ \ V\_{\theta}:=\beta V\_{\theta}+(1-\beta)\theta\_t
$$

$$
}
$$


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://baozoulin.gitbook.io/neural-networks-and-deep-learning/di-er-men-ke-gai-shan-shen-ceng-shen-jing-wang-luo-chao-can-shu-tiao-shi-zheng-ze-hua-yi-ji-you-hua/improving-deep-neural-networks/optimization-algorithms/24-li-jie-zhi-shu-jiaquanping-jun-shu-ff08-understandingexponentially-weighted-averages.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
