22.02.2024 Views

Daniel Voigt Godoy - Deep Learning with PyTorch Step-by-Step A Beginner’s Guide-leanpub

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Let’s take the first alternative and expand the equation a bit:

Equation 6.4 - EWMA - expanded edition

The first element is taken at face value, but all the remaining elements are

discounted based on their corresponding lags.

"What is a lag?"

It is simply the distance, in units of time, from the current value. So, the value of

feature x one time unit in the past is the value of feature x at lag one.

After working out the expression above, we end up with an expression where each

term has an exponent depending on the corresponding number of lags. We can use

this information to make a sum out of it:

Equation 6.5 - EWMA - lag-based

In the expression above, T is the total number of observed values. So, an EWMA

takes every value into account, no matter how far in the past it is. But, due to the

weight (the discount factor), the older a value gets, the less it contributes to the

sum.

Higher values of alpha correspond to rapidly shrinking weights;

that is, older values barely make a difference.

Let’s see how the weights are distributed over the lags for two averages, an EWMA

with alpha equals one-third and a simple five-period moving average.

456 | Chapter 6: Rock, Paper, Scissors

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!