Talk:Rolling Averages

From Robowiki
Revision as of 20:58, 16 May 2009 by Chase-san (talk | contribs) (New section: What Rolling Average Does)
Jump to navigation Jump to search
Credits - Rolling Averages
Old wiki page: RollingAverage
Original author(s): RoboWiki contributors

Time Weighted Rolling Average

Err, Nat, Paul Evans's version, and "Time Weighted Rolling Average" are essentially the same. The way you calculate the numeric constant is different, but the end result is the same. About the statement "The old value that exceed the n limited will be removed from averaged value like a magic!" isn't really anything magic, it's just weighting old values less. --Rednaxela 03:28, 17 February 2009 (UTC)

Thanks! I haven't realize that, just copy from old wiki! I'll change this page and move "Time Weighted Rolling Average" to sample implementations instead. About that statement, the value that exceed n will weight less enough that has really no side effects. The statement "like magic!" is one of statement on the old wiki, I want to keep it.

What Rolling Average Does

If I understand this correctly(and I hope I do). Basically, this is what rolling average does, but without the extra history data. Maybe the article should explain this better. --Chase 19:58, 16 May 2009 (UTC)

double bin[] = new double[31];
int history[] = new int[31];
int fired = 0;

public void averageBins(int nBin) {
    fired++;
    history[nBin]++;
    for(int i=0; i<31; i++) {
        bin[i] = history[i]/(double)fired;
    }
}