Whats the output for Keras categorical_accuracy metrics?

1.1k Views Asked by At

I cant find proper description of metrics outputs.

For example if I use

model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])

then I get loss and accuracy tr_loss, tr_acc = model.train_on_batch(X, Y)

if I compile with metrics=['categorical_accuracy'] then I get 2 numbers as well,

but what are they ?

EDIT: I did this: print(model.metrics_names) and got: ['loss', 'categorical_accuracy']

2

There are 2 best solutions below

1
On BEST ANSWER

The accuracy metric is actually a placeholder and keras chooses the appropriate accuracy metric for you, between binary_accuracy if you use binary_crossentropy loss, and categorical_accuracy if you use categorical_crossentropy loss.

So in this specific case, both metrics (accuracy and categorical_accuracy) are literally the same, and model.evaluate return loss and accuracy.

0
On

Could you please post the two numbers you mentioned? I guess they are loss (categorical_crossentropy in your case) and metrics you added. (accuracy or categorical_accuracy as configured in your case).