Skip to content

fix: clamp topic_entropy to prevent negative values and add pytest suite#4

Merged
huangyz0918 merged 1 commit into
google-deepmind:mainfrom
Karan24Soni:main
Jun 16, 2026
Merged

fix: clamp topic_entropy to prevent negative values and add pytest suite#4
huangyz0918 merged 1 commit into
google-deepmind:mainfrom
Karan24Soni:main

Conversation

@Karan24Soni

Copy link
Copy Markdown
Contributor

fixed a bug in topic_entropy where single-class distributions were returning a tiny negative number (like -1.44e-12) because of that 1e-12 smoothing. just clamped it to 0 so it stops acting weird.
also added a tests/ folder at the repo root since pyproject.toml already had testpaths = ["tests"] but there were zero tests. wrote 25 pytest tests covering topic_entropy, embedding_coverage, overall_diversity, failure_rate, and compute_samples_to_threshold from proeval/utils/metrics.py — all pure functions so no API keys or GPU needed to run em.

@Karan24Soni

Copy link
Copy Markdown
Contributor Author

is there any updates?

@huangyz0918

Copy link
Copy Markdown
Member

@Karan24Soni Thank you for the fix!

@huangyz0918 huangyz0918 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Karan24Soni

Copy link
Copy Markdown
Contributor Author

@huangyz0918 Thanks for the review and approval! Just checking whether there is anything else needed from my side before this PR can be merged.

@huangyz0918 huangyz0918 merged commit 8c0422d into google-deepmind:main Jun 16, 2026
6 checks passed
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.

2 participants