Skip to content

New classification metrics#154

Open
gaga1313 wants to merge 3 commits into
google:mainfrom
gaga1313:new_classification_metrics
Open

New classification metrics#154
gaga1313 wants to merge 3 commits into
google:mainfrom
gaga1313:new_classification_metrics

Conversation

@gaga1313

Copy link
Copy Markdown
Collaborator

This PR adds three new core classification accuracy metrics to metrax (BinaryAccuracy, CategoricalAccuracy, and SparseCategoricalAccuraacy) ensuring parity with reference implementations in keras.metrics.

BinaryAccuracy: Calculates frequency of (predictions >= threshold) == labels.
CategoricalAccuracy: Calculates frequency of argmax(predictions, -1) == argmax(labels, -1).
SparseCategoricalAccuracy: Calculates frequency of argmax(predictions, -1) == labels with auto-squeezing for 2D target vectors (batch, 1).
Added parameterized test suites validating exact numerical parity against keras.metrics across float16, float32, and bfloat16 with weighted/unweighted samples and threshold bounds (0.1, 0.5, 0.7)

@gaga1313 gaga1313 changed the title added new classification metrics New classification metrics Jul 20, 2026
copybara-service Bot pushed a commit that referenced this pull request Jul 22, 2026
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