Convert a list of categorical labels into a one-hot encoded matrix.
Constraints
Example
>>> one_hot_encode(["red", "blue", "red"]) [[0, 1], [1, 0], [0, 1]] >>> one_hot_encode(["b", "a"]) [[0, 1], [1, 0]] >>> one_hot_encode(["x"]) [[1]]
Recent Submissions
No submissions yet — hit Run Tests to try!
Hints