Code QuizIntermediate One-Hot Vector Wrong Length
Identify the off-by-one sizing bug in one-hot encoding.
Codepython
def one_hot(token, vocab):
vec = [0] * (len(vocab) - 1)
idx = vocab.index(token)
vec[idx] = 1
return vec
vocab = ['cat', 'dog', 'fish']
print(one_hot('fish', vocab))What is the bug in this one-hot encoding function?