I wrote a code like below
t_p=0
f_p=0
f_n=0
t_n=0
while True:
line=raw_input()
if not line:
break
actual,predicted=line.split(',')
print actual, predicted
if (actual==1 and predicted==1):
t_p+=50
print "tp", t_p
elif(actual==0 and predicted==1):
f_p+=-25.1
print "fp", f_p
elif(actual==1 and predicted==0):
f_n+=-50.0
print "fn", f_n
else:
t_n=0.0
print "tn", t_n
score=t_p+f_p+f_n+t_n
print score
Now when I pass the following:
0,0
0 0
tn 0.0
0,1
0 1
tn 0.0
1,0
1 0
tn 0.0
1,1
1 1
tn 0.0
1,1
1 1
tn 0.0
It seems to be taking tn value only always which shouldnt be since the values satisfy other conditions based on the values of those two variables.