I have a numpy vector of size (N,)
which contains integers betwen 1-5
and by using the keras function to_categorical I am constructing the corresponing binary matrix that have size (Nx5)
. For example if the first value of the vector is 1 then the first row of the array it is (1, 0, 0, 0, 0)
. How can I do the opposite? By having an array of values (could also double values) to return the index with the highest value? Is there any command that can do that automatically?
As an example my input could be an 2D array with doubles for example one row could be [[0.025, 0.022, 0.58, 0.011, 0.22 ]....]
and the result to be for that row [3 ...]
.