09 September 2016 2 963 Report

this is code I used

#prepare labels

labelsPostive=numpy.ones((postiveImgNumbers,),dtype=int)

labelsNegative=numpy.zeros((negativeImgNumbers,),dtype=int)

labels=numpy.concatenate((labelsPostive,labelsNegative))

but this gave me an error:"

Exception: You are passing a target array of shape (11438, 1) while using as loss `categorical_crossentropy`. `categorical_crossentropy` expects targets to be binary matrices (1s and 0s) of shape (samples, classes). If your targets are integer classes, you can convert them to the expected format via:

```

from keras.utils.np_utils import to_categorical

y_binary = to_categorical(y_int)"

I have only one class (my problem is binary classification )and do not need to use "to_categorical(y_int)"

More Walid Aly's questions See All
Similar questions and discussions