What's wrong
RFMTransformer.fit and RFMTransformer.transform each have a one-line docstring with no Parameters, Returns, or Raises sections. Every sibling transformer's fit/transform pair documents all three (see WealthScreeningImputer, or CRMCleaner/FiscalYearTransformer/WealthPercentileTransformer, fixed in #33) — RFMTransformer is the one that got missed. RFMTransformer.get_feature_names_out, in the same file, already has the full shape to copy.
Because the API reference is generated by mkdocstrings from a bare ::: philanthropy.preprocessing directive, both methods currently render on the docs site as a signature with almost nothing under it.
Where
| File |
Locate with |
philanthropy/preprocessing/_rfm.py |
grep -n "def fit|def transform|def get_feature_names_out" philanthropy/preprocessing/_rfm.py |
What to change
NumPy format (mkdocs.yml sets docstring_style: numpy). Copy the shape from RFMTransformer.get_feature_names_out in the same file, or from WealthScreeningImputer.fit/transform in philanthropy/preprocessing/_wealth.py.
RFMTransformer.fit — document X, y in Parameters; self in Returns, naming the attributes it freezes (feature_names_in_, n_features_in_, reference_date_ — and say plainly that reference_date_ is taken from the constructor argument when given, otherwise computed as the max gift_date seen during fit and frozen from there, per the leakage-safety contract in AGENTS.md). Add a Raises section for the ValueError from _validate_input when a required column is missing.
RFMTransformer.transform — document X in Parameters; the returned donor_id/recency/frequency/monetary frame in Returns. Add a Raises section covering both the NotFittedError (via check_is_fitted) and the TypeError/ValueError paths already in the method body.
Do not change any code, only add docstrings.
Tests to add or extend
None — docs-only, no coverage-gated logic changes.
Done when
python -c "
from philanthropy.preprocessing import RFMTransformer
assert RFMTransformer.fit.__doc__ and 'Parameters' in RFMTransformer.fit.__doc__
assert RFMTransformer.transform.__doc__ and 'Parameters' in RFMTransformer.transform.__doc__
print('PASS')
"
make ci
make riskcov
First time here?
Read CONTRIBUTING.md and AGENTS.md. Docs-only fix — GitHub's web editor and a PR from there works, no local setup needed. Add a ## [Unreleased] CHANGELOG entry and yourself to CONTRIBUTORS.md in the same PR.
What's wrong
RFMTransformer.fitandRFMTransformer.transformeach have a one-line docstring with noParameters,Returns, orRaisessections. Every sibling transformer'sfit/transformpair documents all three (seeWealthScreeningImputer, orCRMCleaner/FiscalYearTransformer/WealthPercentileTransformer, fixed in #33) —RFMTransformeris the one that got missed.RFMTransformer.get_feature_names_out, in the same file, already has the full shape to copy.Because the API reference is generated by mkdocstrings from a bare
::: philanthropy.preprocessingdirective, both methods currently render on the docs site as a signature with almost nothing under it.Where
philanthropy/preprocessing/_rfm.pygrep -n "def fit|def transform|def get_feature_names_out" philanthropy/preprocessing/_rfm.pyWhat to change
NumPy format (
mkdocs.ymlsetsdocstring_style: numpy). Copy the shape fromRFMTransformer.get_feature_names_outin the same file, or fromWealthScreeningImputer.fit/transforminphilanthropy/preprocessing/_wealth.py.RFMTransformer.fit— documentX,yinParameters;selfinReturns, naming the attributes it freezes (feature_names_in_,n_features_in_,reference_date_— and say plainly thatreference_date_is taken from the constructor argument when given, otherwise computed as the maxgift_dateseen during fit and frozen from there, per the leakage-safety contract inAGENTS.md). Add aRaisessection for theValueErrorfrom_validate_inputwhen a required column is missing.RFMTransformer.transform— documentXinParameters; the returneddonor_id/recency/frequency/monetaryframe inReturns. Add aRaisessection covering both theNotFittedError(viacheck_is_fitted) and theTypeError/ValueErrorpaths already in the method body.Do not change any code, only add docstrings.
Tests to add or extend
None — docs-only, no coverage-gated logic changes.
Done when
First time here?
Read CONTRIBUTING.md and AGENTS.md. Docs-only fix — GitHub's web editor and a PR from there works, no local setup needed. Add a
## [Unreleased]CHANGELOG entry and yourself toCONTRIBUTORS.mdin the same PR.