I have an array
y_train: array([ 0, 0, 0, -1, 1, 0, -1, 0, ..., -1, 0, 1], dtype=int64)
I did this:
enc = OneHotEncoder()
y_train = enc.fit_transform(y_train.reshape(1,-1))
and the result came out to be
(0, 0) 1.0
(0, 1) 1.0
(0, 2) 1.0
(0, 3) 1.0
(0, 4) 1.0
(0, 5) 1.0
But what I really want is it to be onehot encoded like following:
[1,0,0]
[1,0,0]
[0,1,0]
[0,0,1]
.....
How to fix it?