Skip to content

BrianPi/IterativeMean

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

IterativeMean

A class from which to derive iterative means. There are three means included as examples, a normal arithmetic-geometric mean (accepting only positive values), a custom mean 'Clocks-at-Sea', described below, and an arithmetic-geometric mean extended to accept negative values. Each mean was optimized with gprof after being compiled with the -O3 flag.

The 'Clocks-at-Sea' mean works by modelling having a certain number of 'clocks' which have different relative displacements ('times') each 'day'. It's based on the adage "Never bring two clocks to sea, bring one or three." If you have one clock it's automatically the most valid, and if you have three, you can always find the outlier. I modeled the behavior of a ship's captain who might be adjusting these clocks. After each 'day' (iteration), the clock that's the farthest from the arithmetic mean is reset to the arithmetic mean ignoring that clock. The other clocks continue running. The mean involves carrying a state for each 'clock' over a number of iterations. Storing and accessing this data efficiently is a challenge to optimize, and I believe I've done a good job bringing the runtime for this novelty mean down as much as possible. I do not recommend using this mean in general production code; it can converge slowly and takes on the order of seconds for millions of iterations on my machine. Still, it gives an arithmetic average of a dataset that is robust against outliers, which may be useful in very specific applications.

Yes, now including the Geothmetic Meandian. XD Unlike the other means, it has side-effects on the passed in vector.

About

A class from which to derive iterative means.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages