TF.keras.metrics.AUC does not work on multiclass

Viewed 184

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.

0 Answers
Related