Hi everyone,
I have ground_truth which is numpy list and is hot vector list of actions.
array([[0. , 1. , 0. ],
[0. , 1. , 0. ],
[0. , 1. , 0. ],
...,
[0. , 0. , 0.8],
[0. , 0. , 0.8],
[0. , 0. , 0.8]], dtype=float32)
I want to map it like
{ '[-1.0, 0.0, 0.0]' : '[1.0, 0.0, 0.0, 0.0]',
'[+1.0, 0.0, 0.0]' : '[0.0, 1.0, 0.0, 0.0]',
'[0.0, +1.0, 0.0]' : '[0.0, 0.0, 1.0, 0.0]',
'[0.0, 0.0, 0.8]' : '[0.0, 0.0, 0.0, 1.0]' }
I did this loop below to make it but in some cases although my ground truth is sth else, but it gives me like [0.0, 0.0, 0.0, 0.0]. Would you please help me about it.
my already code is:
new_ground_truth=[]
z = [0 , 0 , 0]
for g in range (len(ground_truth)):
blank = np.zeros(4)
if(not(ground_truth[g] == z).all()):
if(ground_truth[g][0]== -1): blank[0] = 1
if(ground_truth[g][0]== 1) : blank[1] = 1
if(ground_truth[g][1]== 1) : blank[2] = 1
if(ground_truth[g][2]==0.8): blank[3] = 1
else:
None
new_ground_truth.append(np.asarray(blank))
one of test cases which gives me wrong value:
ground_truth[4989] = array([0. , 0. , 0.8], dtype=float32)
but
new_ground_truth[4989]= array([0., 0., 0., 0.])