labels = np.array([['positive'],['negative'],['negative'],['positive']])
# output from pandas is similar to the above
values = (labels=='positive').astype(np.int_)
to_categorical(values,2)
Output:
array([[ 1., 1.],
[ 1., 1.],
[ 1., 1.],
[ 1., 1.]])
If I remove the inner list enclosing for each element, it seems to work just fine
labels = np.array([['positive'],['negative'],['negative'],['positive']])
values = (labels=='positive').astype(np.int_)
to_categorical(values.T[0],2)
Output:
array([[ 0., 1.],
[ 1., 0.],
[ 1., 0.],
[ 0., 1.]])
Why is it behaving this way? I'm following some tutorials, but they seem to have gotten the right output even for array of arrays. Is that recently upgraded to behave this way?
I'm using tflearn (0.3.2)
on py362