Skip to content

DEP: warn when drop_repeat_donors default is used (closes #108) - #147

Open
shubhrai23 wants to merge 1 commit into
PhilanthroPy-Project:mainfrom
shubhrai23:deprecate-drop-repeat-donors-default
Open

DEP: warn when drop_repeat_donors default is used (closes #108)#147
shubhrai23 wants to merge 1 commit into
PhilanthroPy-Project:mainfrom
shubhrai23:deprecate-drop-repeat-donors-default

Conversation

@shubhrai23

Copy link
Copy Markdown
Contributor

Summary

FiscalYearGroupedSplitter(drop_repeat_donors=...) currently defaults to False, which silently allows repeat donors across train and test folds. This PR deprecates that default so it will change to True in 0.8.0, following the pattern established by WealthScreeningImputerKNN.group_col_idx.

Changes

philanthropy/model_selection/_temporal_donor_splitter.py

  • Default changed from False to the sentinel "warn".
  • __init__ now emits a DeprecationWarning when the default is left untouched.
  • split() and get_n_splits() resolve "warn" to False internally, so behaviour is unchanged.
  • Docstring updated with a .. deprecated:: 0.7.0 block.
  • Doctests updated to pass drop_repeat_donors=False explicitly to avoid warnings.

tests/test_model_selection.py

  • Added test_default_drop_repeat_donors_emits_deprecation_warning.
  • Added test_explicit_drop_repeat_donors_false_silences_warning.
  • All existing tests now pass drop_repeat_donors=False explicitly or wrap in pytest.warns(DeprecationWarning).

tests/test_deprecations.py

  • Added FiscalYearGroupedSplitter.drop_repeat_donors to the DEPRECATIONS registry so the meta-test passes.

tests/test_leakage.py

  • Silenced the new warning by passing drop_repeat_donors=False explicitly.

CHANGELOG.md

  • Added entry under [Unreleased] / Deprecated.

Checklist

  • Changelog updated
  • Author credited in CONTRIBUTORS.md (already listed from prior PRs)
  • All tests pass locally (64 passed)
  • flake8 clean
  • mypy clean

Closes #108

FiscalYearGroupedSplitter(drop_repeat_donors=...) now defaults to
'warn', which emits a DeprecationWarning telling the caller that
the default will change from False to True in 0.8.0.  Internally
the splitter still treats 'warn' as False, so behaviour is unchanged.

- Add deprecation entry to DEPRECATIONS registry in test_deprecations.py
- Update all existing tests to pass drop_repeat_donors=False explicitly
  or wrap in pytest.warns(DeprecationWarning)
- Silence doctests by passing drop_repeat_donors=False
- Update CHANGELOG.md under [Unreleased] / Deprecated
- Fix test_leakage.py to pass drop_repeat_donors=False explicitly

Closes PhilanthroPy-Project#108
Copilot AI lite review requested due to automatic review settings August 26, 2026 08:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

FiscalYearGroupedSplitter: drop_repeat_donors defaults to False, so the default path still leaks a static per-donor label across folds

2 participants