I have this nparray :
[[0. 0. 0. 0. 1.]
[1. 0. 0. 0. 0.]
[0. 0. 1. 0. 0.]
...
[0. 0. 1. 0. 0.]
[0. 0. 0. 0. 1.]
[1. 0. 0. 0. 0.]]
and I want to do something like this :
for item in array :
if item[0] == 1:
item=[0.8,0.20,0,0,0]
elif item[1] == 1:
item=[0.20,0.80,0,0,0]
elif item[3] == 1:
item=[0,0,0,0.8,0.2]
elif item[4] == 1:
item=[0,0,0,0.2,0.8]
else:
[0,0,1,0,0]
I try this :
def conver_probs2(arg):
test= arg
test=np.where(test==[1.,0.,0.,0.,0.], [0.8,0.20,0.,0.,0.],test)
return test
but the result is this :
[[0. 0.2 0. 0. 1. ]
[0.8 0.2 0. 0. 0. ]
[0. 0.2 1. 0. 0. ]
...
[0. 0.2 1. 0. 0. ]
[0. 0.2 0. 0. 1. ]
[0.8 0.2 0. 0. 0. ]]
not what I want ... any ideas?
Thanks!