2

I have a multiclass problems. Three classes with labels 0 1 and 2.

If I create a model netowrk and I run this at the end

model.add(Activation('softmax')) 
model.compile(optimizer = 'adam',loss='sparse_categorical_crossentropy',
                  metrics=['sparse_categorical_accuracy',tf.keras.metrics.AUC(name = 'auc')])

I always receive immediately the error

ValueError: Shapes (None, 3) and (None, 1) are incompatible

If I remove

tf.keras.metrics.AUC(name = 'auc')

from the metrics everything works.

I read the documentation about tf.keras.metrics.AUC and it should work in the case of multi-class, but to me it does not.

desertnaut
  • 57,590
  • 26
  • 140
  • 166
Mobius88
  • 101
  • 1
  • 7
  • Is your issue resolved now? Else, can you share standalone code to replicate your issue, so that we can try to help you. Thanks! –  Mar 17 '21 at 13:55

0 Answers0