I have two lists with values, the expected result is a tuple (a,b) where a is the number of i values which list1[i] < list2[i], and b is the number of i values where list1[i] > list2[i] (equalities are not counted at all).
I have this solution, and it works perfectly:
x = (0,0)
for i in range(len(J48)):
if J48[i] < useAllAttributes7NN[i]:
x = (x[0]+1,x[1])
elif J48[i] > useAllAttributes7NN[i]:
x = (x[0], x[1]+1)
However, I am trying to improve my python skills, and it seems very non-pythonic way to achieve it.
What is a pythonic way to achieve the same result?
FYI, this is done to achieve the required input for binom_test() that tries to prove two algorithms are not statistically identical.
I don’t believe this information has any additional value to the specific question though.
One way is to build a set of scores and then add them up.
Another is to zip them once then count scores separately:
Note that this doesn’t work in Python 3 (thanks @Darthfett).