Exponential Weighted Average Clarification

Hi Mentor,

@paulinpaloalto

We need below clarifications. Can u please help to clarify ?

From the lecture Understanding exponential weighted average

  1. And so, in other words, it takes about 10 days for the height of this to decay to around 1/3 already one over E of the peak. What does it mean with respect to 1/3 ?

  2. I cannot understand the statement here. By averaging over large day of temperature, EWA adapts slowly when the temperature changes. By averaging over short day of temperature, EWA adapts quickly when the temperature changes

  3. Is the green curve shifted due to large weight value to previous day temperature, small weight value to current day temperature ? If so how it makes ?

  4. Because it’s after 10 days that the weight decays to less than about a third of the weight of the current day

Here’s an earlier thread that talks about how the value 1/3 is derived.

Here’s another thread that discusses the general purpose of EWA.

If those aren’t enough to give you the intuition that you are looking for, then I think the best idea is create a couple of sample sequences of temperatures and then compute the EWA with different values of \alpha and watch what happens. For example, create 50 samples where the first 10 or 20 bounce around with an average of 70 degrees (or 20 if you like Celsius :nerd_face:) and then start trending upward towards a mean that is say 10 degrees higher. Try it with \beta = 0.9 and then with \beta= 0.7 and watch the difference in behavior as you compute the EWA values for the whole sequence.

If that’s still not enough, then after doing the above I think you should just go back and watch the lecture again with all the above in mind.

1 Like

Hi Sir,

we read the thread. But point 2 not discussed can u help to describe ?

2. I cannot understand the statement here. By averaging over large day of temperature, EWA adapts slowly when the temperature changes. By averaging over short day of temperature, EWA adapts quickly when the temperature changes

The point is that the behavior of EWA is determined by the value of \beta that you select. If you select a large value of \beta (\geq 0.9) then the EWA reacts more slowly to sudden recent changes and is effectively averaging over a longer stretch of the past values. With a lower \beta value (say 0.8 or 0.7), the EWA reacts more quickly and is influenced by less of the “history”. That was my point about the best way to understand this is just to construct some examples and then watch what happens with different values of \beta.

1 Like

Sorry, it had been a long time since I had watched those videos. The rule of thumb that Prof Ng gives and also explains in the two lectures about EWA is that you can roughly think of the EWA as the average over the last \frac {1}{1 - \beta} days. So if you use \beta = 0.9, you are roughly getting the average over the last 10 days. The other two examples he discusses are \beta = 0.98, which gives you an average over roughly the last 50 days. And in the other direction \beta = 0.5 gives you the average over the last two days roughly.

After watching the lectures again, I think your point 3) in your original question is completely wrong. The green curve is for \beta = 0.98, so it is the average over the last 50 days. That means that it changes very slowly and that is what causes it to look shifted to the right. It is giving only a very small weight to the most recent temperatures and it affected by a lot more of the history than with \beta = 0.9 (the red curve). That’s also why it’s smoother than the red curve.

Sir Here sudden recent changes means when the actual temperature changes, EWA reacts slowly to the actual temperature. Is my understanding correct ?

Yes, I meant sudden recent changes in whatever the input value is (temperature in the example Prof Ng is using here). The point is that how fast or slow EWA reacts to recent changes is entirely determined by the \beta value you are using. If you use a relatively high \beta (meaning > 0.9), then it reacts slowly. If you use a lower value of \beta like 0.6 or 0.5, then it reacts pretty quickly. It all depends. But I think in the cases for which Prof Ng will be using EWA, he will typically be choosing values in the 0.9 and above range, so that we get behavior that is on the “slower” side of the spectrum.

1 Like

Thank you sir and kind reply