All problems
One-Hot Decoding
Problem
Decode a list of one-hot vectors into class indices.
Return the index of the largest entry of each vector, keeping the smallest index on ties. An empty vector list returns [].
Test cases
case 1
in: [[[1,0,0],[0,1,0],[0,0,1]]]
expected: [0,1,2]
case 2
in: [[[0,0,1],[1,0,0]]]
expected: [2,0]
case 3
in: [[[1]]]
expected: [0]
case 4
in: [[]]
expected: []
Starter codePython
def decode_one_hot(vectors):
# Your code here
pass4 test cases · run your code against them in the editor