Hamming Distance

Previously, we discussed how removing information from data can be useful. And our discussion on using Euclidean Distance for Pattern Matching showed how you can use a rolling window to identify matching segments within a time-series. What if we mix the two ideas together?

If you transform a time-series of returns to 0-1, then we can use Hamming distance, a measure the minimum number of substitutions required to change one string into the other (Wikipedia,) as a measure of similarity.

For example, take the most recent 20-day VIX time-series and “match” it with a rolling window of historical 20-day VIX segments and sort it by its Hamming Distance.

Here, on the second row, we see that by just flipping two bits, the 20-day sequence ending on 2020-05-18 matches with the 20-day sequence ending 2021-11-16.
If you are looking for a rough up/down days match, then this is a blistering fast way to compute it.

Comments are closed, but trackbacks and pingbacks are open.