I have this function:
import numpy as np
def unhot(vec):
""" takes a one-hot vector and returns the corresponding integer """
assert np.sum(vec) == 1 # this assertion shouldn't fail, but it did...
return list(vec).index(1)
that I call on the output of a call to:
numpy.random.multinomial(1, coe)
and I got an assertion error at some point when I ran it. How is this possible? Isn't the output of numpy.random.multinomial guaranteed to be a one-hot vector?
Then I removed the assertion error, and now I have:
ValueError: 1 is not in list
Is there some fine-print I am missing, or is this just broken?