Skip to content

Added 3 new classification metrics.#150

Open
gaga1313 wants to merge 6 commits into
google:mainfrom
gaga1313:classification_metrics
Open

Added 3 new classification metrics.#150
gaga1313 wants to merge 6 commits into
google:mainfrom
gaga1313: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 force-pushed the classification_metrics branch from a5e5a80 to 0ff22c1 Compare June 17, 2026 22:17
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