Skip to content

docs: describe NumericDiff as it works - #252

Open
berce (bercedev) wants to merge 1 commit into
braintrustdata:mainfrom
bercedev:docs/numericdiff-options
Open

berce (bercedev) wants to merge 1 commit into
braintrustdata:mainfrom
bercedev:docs/numericdiff-options

Conversation

@bercedev

Copy link
Copy Markdown

Fixes #251.

SCORERS.md documented max_diff and relative options for NumericDiff, but neither the Python nor the JS scorer reads them, so a caller who sets a tight tolerance silently gets the default score. As the issue notes, they only ever existed in the docs.

This takes the docs route: the NumericDiff section now describes what both implementations compute, 1 - |output - expected| / (|output| + |expected|), with an example whose score matches the code. I also corrected the Python docstring example, which said 105 vs 100 scores 0.95; the scorer returns 0.9756.

I checked the numbers in the new text against the real Python NumericDiff:

output expected score
105 100 0.9756
10.5 10.0 0.9756
0 0 1
5 -5 0.0
0 3 0.0

prettier --check SCORERS.md (3.3.2, the pre-commit version) passes.

If you would rather implement the two options than drop them from the docs, I'm happy to rework this into that.

SCORERS.md documented max_diff and relative options that neither implementation reads. Document the actual normalized-difference formula instead, and correct the docstring example (105 vs 100 scores 0.9756, not 0.95). Fixes braintrustdata#251.

This branch has not been deployed

No deployments
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.

NumericDiff ignores documented tolerance options and can score near misses highly

1 participant