Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EWMA Comparisons #1

Open
lifenjoiner opened this issue Mar 20, 2021 · 2 comments
Open

EWMA Comparisons #1

lifenjoiner opened this issue Mar 20, 2021 · 2 comments

Comments

@lifenjoiner
Copy link
Owner

Here is an easy to use helper to give you a glance over different EWMA strategies:
EWMA_cmp.xlsx

Just refresh the random samples or change the N :)

@lifenjoiner lifenjoiner pinned this issue Mar 20, 2021
@lifenjoiner
Copy link
Owner Author

lifenjoiner commented Apr 4, 2022

EWMA_cmp_plot.xlsx

ewma-cmp.gif

Explanation:
0. Image the moving window selecting the data samples.

  1. Average in column I is the exact average of the selected samples. It is the ideal result, the base that others will compare to.
  2. N in cell A2 is the moving window size.
  3. Alpha in cell B2 is the solid decay, the W of EWMA.
  4. n in column C is the index of samples.
  5. V in column D is the random value as samples.
  6. alpha in column E is the just-in-time decay, the W of EWMA.
  7. EWMA Variant is the result of adding the the 1st sample by using Add.
  8. EWMA Continuing is the result of adding the the 1st sample by using Set.
  9. EWMA Warmup is the result of the VividCortex implement with WARMUP_SAMPLES = N - 1, and adding the the 1st sample by using Add.

Comparing to VividCortex implement:
EWMA Continuing should be the same, while they both add the the 1st sample by using Set.
EWMA Warmup should be the same, while they both use the moving window size equal to WARMUP_SAMPLES.

More discussions: DNSCrypt/dnscrypt-proxy#2079

@lifenjoiner
Copy link
Owner Author

2 strategies at the "warmup" stage related to how to deal with the outliers:

  1. Add the 1st sample by using Add. The following samples have more (decreasing to stable) weight.
  2. Add the 1st sample by using Set. The following samples have less weight.

Things you may need to consider:

  1. Can you tell which one is outlier, the 1st, the 2nd, or the 3rd? If none, the nearer to exact average the better. If the 1st is, the average should be adjusted quicker/heavier. If one of the following is, the average should be adjusted slower/lighter.
  2. What is the outlier ratio of a server? If it is high, the server is less reliable, adjusting quicker is better, the stable one will win at last. If all are low, they are reliable, the nearer to exact average the better.

Anyway, the above is a rough/lazy way. If you really care about outliers, you should deal with them in an earlier stage: the validate/cleanup stage, for all samples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant