Add test coverage for IPW helpers#341
Closed
neuralsorcerer wants to merge 3 commits intofacebookresearch:mainfrom
Closed
Add test coverage for IPW helpers#341neuralsorcerer wants to merge 3 commits intofacebookresearch:mainfrom
neuralsorcerer wants to merge 3 commits intofacebookresearch:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds focused unit test coverage for three previously untested IPW helper functions: model_coefs(), link_transform(), and calc_dev(). The tests validate core behavior including coefficient extraction for linear vs non-linear models, probability clipping at extremes, and finite deviance outputs from cross-validation.
Changes:
- Added three new test methods covering
model_coefs(),link_transform(), andcalc_dev()helper functions - Removed TODO comments from the source file indicating tests were needed for these functions
- Updated CHANGELOG with entry describing the new test coverage
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/test_ipw.py | Added three focused unit tests for IPW helper functions, testing linear/non-linear model coefficients, probability clipping behavior, and cross-validation deviance outputs |
| balance/weighting_methods/ipw.py | Removed three TODO comments indicating tests were needed for model_coefs(), link_transform(), and calc_dev() |
| CHANGELOG.md | Added entry under Tests section documenting the new IPW helper test coverage |
talgalili
requested changes
Feb 19, 2026
|
@talgalili has imported this pull request. If you are a Meta employee, you can view this in D93743291. |
|
@talgalili merged this pull request in 09102a3. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
model_coefs()already has explicit tests for linear-model coefficient extraction (including intercept + named features) and non-linear-model empty coefficient behavior.link_transform()now has coverage for midpoint and extreme probability clipping behavior.calc_dev()now has coverage ensuring finite, non-negative 10-fold CV deviance outputs.