Skip to content

Commit 5d50953

Browse files
docs: Keras 3 evaluate() and compiled metrics clarification (#21506)
* docs: Keras 3 evaluate() and compiled metrics clarification * Fix docstring formatting * fix: correct formatting of evaluate() with backticks
1 parent 4e1b250 commit 5d50953

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

keras/src/trainers/trainer.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -793,8 +793,16 @@ def evaluate(
793793
Returns:
794794
Scalar test loss (if the model has a single output and no metrics)
795795
or list of scalars (if the model has multiple outputs
796-
and/or metrics). The attribute `model.metrics_names` will give you
797-
the display labels for the scalar outputs.
796+
and/or metrics).
797+
798+
Note: When using compiled metrics, `evaluate()` may return multiple
799+
submetric values, while `model.metrics_names` often lists only
800+
top-level names (e.g., 'loss', 'compile_metrics'), leading to a
801+
length mismatch. The order of the `evaluate()` output corresponds
802+
to the order of metrics specified during `model.compile()`. You can
803+
use this order to map the `evaluate()` results to the intended
804+
metric. `model.metrics_names` itself will still return only the
805+
top-level names.
798806
"""
799807
raise NotImplementedError
800808

0 commit comments

Comments
 (0)