Keras np_utils.to_categorical behaves differently

Viewed 2262

Why does Keras to_categorical behaves differently on [1, -1] and [2, -2]?

y = [1, -1, -1]
y_ = np_utils.to_categorical(y)
array([[ 0.,  1.],
       [ 0.,  1.],
       [ 0.,  1.]])


y = [2, -2, -2]
y_ = np_utils.to_categorical(y)
array([[ 0.,  0.,  1.],
       [ 0.,  1.,  0.],
       [ 0.,  1.,  0.]])
2 Answers
Related