Skip to content

docs: RFMTransformer.fit and .transform document neither Parameters nor Returns #52

Description

@shivamlalakiya

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.

  1. 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.
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    beginnerNo fundraising domain knowledge neededdocumentationImprovements or additions to documentationeasySmall, well-scoped, single-file changegood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions