Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def one_hot_encode(y):
- encoded = np.zeros((y.shape[0], 3))
- for i, l in enumerate(y):
- encoded[i, l] = 1.
- return encoded
- encoded = one_hot_encode(labels)
- print(encoded[[0, 51, 101]])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement