One-Hot-Encoding Problem¶
Given a 1d array of integers, one-hot-encode
it into a 2d array. In other words, convert this 1-d array called yoyoyo
,
import numpy as np
yoyoyo = np.array([3, 1, 0, 1])
into a 2-d array like this.
# [[0. 0. 0. 1.]
# [0. 1. 0. 0.]
# [1. 0. 0. 0.]
# [0. 1. 0. 0.]]