I have 3 vectors representing the 3 different predictions of labels for the same data:
P1=[31, 22, 11, 10, 9, 9, 0, 0, 23 ....] # length over 1M
P2=[31, 22, 12, 10, 8, 9, 0, 0, 30 ....] # length over 1M
P3=[30, 22, 12, 11, 8, 9, 0, 1, 31 ....] # length over 1M
Ans= [31, 22, 12, 10, 8, 9, 0, 0, 23, ....]
The basic idea is if a prediction has the highest vote count (e.g. "31" has count 2 in the first column), we pick it, but if all candidates have a different vote (e.g. "23", "30", "31" in the last column), we can pick any one of them.
These vectors may be numpy array, list or pytorch tensor. Considering the length of such vector is over 1000,000, what's the most efficient way (mainly runtime) to find Ans?