H13-311_V3.5 · Question #327
The following code was used when compiling the model: model.compile(optimizer='Adam,loss='categorical.crossentropy',metrics=[tf.keras.metrics.accurac y]), currently using evaluate When the method…
The correct answer is A. accuracy C. loss. When model.evaluate() runs, Keras always outputs two categories of values: (1) the loss value, always labeled "loss" regardless of which loss function was chosen, and (2) each metric passed to metrics=[] using its display name - tf.keras.metrics.accuracy registers under the…
Question
The following code was used when compiling the model:
model.compile(optimizer='Adam,loss='categorical.crossentropy',metrics=[tf.keras.metrics.accurac y]), currently using evaluate When the method evaluates the model, which of the following indicators will be output?
Options
- Aaccuracy
- Bcategorical_ 1oss
- Closs
- Dcategorical accuracy
How the community answered
(20 responses)- A85% (17)
- B10% (2)
- D5% (1)
Explanation
When model.evaluate() runs, Keras always outputs two categories of values: (1) the loss value, always labeled "loss" regardless of which loss function was chosen, and (2) each metric passed to metrics=[] using its display name - tf.keras.metrics.accuracy registers under the name "accuracy". This is why A (accuracy) and C (loss) are both correct.
Why the distractors fail:
- B (categorical_loss) - this name does not exist in Keras; the loss output is always labeled
"loss", never prefixed with the loss function's name. - D (categorical_accuracy) - this would only appear if you compiled with
metrics=['categorical_accuracy']ortf.keras.metrics.CategoricalAccuracy(); the generictf.keras.metrics.accuracyoutputs as"accuracy", not"categorical_accuracy".
Memory tip: Think of model.evaluate() output as two slots - slot 1 is always loss (the raw loss value, plain label), and slot 2+ are your metrics by their Keras display name. The loss function's full name (categorical_crossentropy) never appears in the output; only the word loss does.
Topics
Community Discussion
No community discussion yet for this question.