Skip to content

Pass integer labels to Accuracy in the Keras guide - #912

Open
AlexShen-Oguri wants to merge 1 commit into
huggingface:mainfrom
AlexShen-Oguri:codex/evaluate-keras-accuracy-labels
Open

AlexShen-Oguri wants to merge 1 commit into
huggingface:mainfrom
AlexShen-Oguri:codex/evaluate-keras-accuracy-labels

Conversation

@AlexShen-Oguri

Copy link
Copy Markdown

Summary

Convert the Keras guide's binary predictions to a flat array of integer labels before calling Accuracy, both in the epoch callback and in the final evaluation. The sigmoid model returns one score per row with shape (batch, 1).

Evidence

Using a small deterministic sigmoid model with Keras 3.15.1 on the Torch backend and NumPy 2.5.5, the original code failed Accuracy's input validation in both paths. The updated callback and final evaluation each returned an accuracy of 1.0. All 22 documentation files built successfully.

AI disclosure — OpenAI Codex reproduced the guide failure, updated the examples, and ran both offline checks.

Flatten the sigmoid predictions and cast the rounded values to
integers in both the callback and the final evaluation.

Co-authored-by: OpenAI Codex <codex@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant