I am trying to preprocess data in python for use in deep learning keras functions.
I use categorical crossentropy as loss function in model fit. It requires categorical variable as target.
My target data sample:
y_train = y_train.astype('category')
y_train.head()
truth
0 0
1 0
2 1
3 0
4 0
When I tried to convert data frame column to categorical:
num_classes=2
y_train = keras.utils.to_categorical(y_train, num_classes)
It produced an error: IndexError: index 1 is out of bounds for axis 1 with size 1.
How do I convert the data properly?
By the way, which keras models are better for binary classification (yes, no) if I have sample of 3800 observations with 2300 numeric (float32) features each? The features describe mostly graphical objects.