Given two sets of binary vectors, what are some optimal ways to calculate their correlation? For example,
Set A:
[1,1,1,0,0,0] [1,0,1,0,1,0] [0,0,1,1,1,1]
Set B:
[1,1,1,0,0,0] [1,0,1,0,1,0] [1,1,1,1,0,0]
Here Sets A and B both have two identical binary vectors ([1,1,1,0,0,0]
and [1,0,1,0,1,0]
), and two exclusive binary vectors ([0,0,1,1,1,1]
and [1,1,1,1,0,0]
).
One approach would be to create a new binary vector that represents if an item in one set (in this case a bitvector) was found in the other set. For example, we could represent the correlation from B to A as [1,1,0], as the first two items in B are distinctly found in Set A while the third is not. Although this works, it seems to oversimplify the problem.
Another approach might be, for each item in one set, find an item in the other set with the highest correlation score and place the result in a vector. If we used a hamming distance as our metric here (just as an example - I know Hamming Distance is a distance metric not a correlation metric), then we could represent the correlation from B to A as [0,0,1], as the first two items in Set B can be associated with an item in A with an optimal hamming score of 0, and the third item in Set B can be associated with an item in A with an optimal hamming score of 1.
This seems a bit better, but ironically in this example the third item in Set B is more closely correlated with the first item in Set A. This isn't necessarily a problem as the set items may be unordered, but in practice (for my purposes) it is unlikely that an element of one set will have two matches from another set, particularly if it as already been matched explicitly.
For a practical example, consider a machine that emits a set of binary patterns of equal length. Now observe another machine that also emits a set of binary patterns of the same length. The patterns are distinct, but the sets are unordered. What is the best way to calculate the correlation between the two machines, such that you can determine how identical machine B is to machine A?
I've found some great algorithms for calculating distance and correlation for binary vectors (Distance Metrics For Binary Vectors), but nothing that works on sets of binary vectors. I would like to combine these techniques into something that works on sets as well.
Any thoughts on this? Should I just go with one of the two approaches I mentioned? Also, if this question is better suited for a different stack exchange please let me know. Thanks.