For example, the figure below shows a sinusoid (sampled at a regular interval). The autocorrelation of the figure is 0.994705 --- almost the maximum value of 1.
In contrast, the figure below has been modified by the autocorrelation minimization algorithm. The two figures have the same y-values, but the x-values have been changed resulting in a new correlation of -0.999955.
The Algorithm
The formula for calculating autocorrelation includes a number of terms, but the only terms that are impacted by changing the order of the list can be reduced to the sum:
$$ \Sigma(x_i - \mu)(x_{i+1} - \mu) $$
where \(\mu\) is the arithmetic mean of the list.
The approach is to maximize occurrences of large negative values.
- Create a list terms with the values of the list minus the mean of the list.
- Sort the list terms.
- Initialize the merged list with the head and tail of terms.
- While elements remain in terms,
- Take an element from terms (either the head or tail) such that the element minus the mean multiplied by the head or tail of merged has minimal value.
- Add the mean to each element of merged. Return that list.
Updated: Algorithm simplified
No comments:
Post a Comment