-2

I am applying ANN to iris dataset and it gives me this error: Model.fit(x_train, y_train, epochs=100, batch_size=2) SyntaxWarning: In loss categorical_crossentropy, expected y_pred.shape to be (batch_size, num_classes) with num_classes > 1. Received: y_pred.shape=(2, 1). Consider using 'binary_crossentropy' if you only have 2 classes. return dispatch_target(*args, **kwargs)

I applied one hot encoding to labels and dropped one label column to avoid one hot encoding

lejlot
  • 64,777
  • 8
  • 131
  • 164
  • The error is pretty self explenatory - there is a special function, binary_crossentropy, to be used if you do what you have done (drop the second column) – lejlot Sep 03 '23 at 01:05

0 Answers0