modestyachts / ARS

An implementation of the Augmented Random Search algorithm
Other
418 stars 103 forks source link

Variance is not computed like in blog post by John D. Cook #3

Closed tobiasfeil closed 6 years ago

tobiasfeil commented 6 years ago

In the aforementioned blog post, one step in computing the variance looks like this:

image

However, in this project, the corresponding step looks like this:

image

Since this image

is the mathematical equation corresponding to this computation, it's looking like the blog post implementation is in accordance to the mathematical formulation while this project's implementation is not. Or am I missing something?

Thanks!

hmania commented 6 years ago

There are multiple ways of updating the standard deviation online. The blog post is a reference for how one might do it. We used a different formula. In particular, note that our update term is multiplied by n1 / self._n , while the update in the blog has no such scaling. Also, note that the function "var" returns self._S / (self._n - 1). To see how to derive the formula we used follow the thread here.