Skip to content

docs: clarify DiD predict support contract#580

Draft
shawcharles wants to merge 1 commit into
igerber:mainfrom
shawcharles:docs/did-predict-contract
Draft

docs: clarify DiD predict support contract#580
shawcharles wants to merge 1 commit into
igerber:mainfrom
shawcharles:docs/did-predict-contract

Conversation

@shawcharles

Copy link
Copy Markdown
Contributor

Closes #579.

Summary

This PR clarifies the current DifferenceInDifferences.predict() contract without adding prediction semantics.

predict() is present on the sklearn-like estimator surface, but it currently raises NotImplementedError. The updated docs and error message make that explicit: out-of-sample prediction is unsupported pending a broader post-estimation result-object design, and fitted training-data predictions are available through results_.fitted_values after fit().

Changes

  • Update DifferenceInDifferences.predict() docstring and NotImplementedError message.
  • Add a regression test for the fitted predict() unsupported contract.
  • Add a short API docs note and include predict in the DifferenceInDifferences method autosummary.
  • Do not implement prediction or alter result-object semantics.

Validation

  • PYTHONPATH=. DIFF_DIFF_BACKEND=python pytest tests/test_methodology_did.py::TestResultsObject::test_predict_contract_points_to_fitted_values -q
  • PYTHONPATH=. DIFF_DIFF_BACKEND=python pytest tests/test_methodology_did.py::TestResultsObject -q
  • PYTHONPATH=. DIFF_DIFF_BACKEND=python pytest tests/test_methodology_did.py -q
  • PYTHONPATH=. DIFF_DIFF_BACKEND=python .venv-py39/bin/python -m pytest tests/test_methodology_did.py::TestResultsObject::test_predict_contract_points_to_fitted_values -q
  • python -m ruff check diff_diff/estimators.py
  • git diff --check

Docs build note: make -C docs html SPHINXOPTS="-W" currently reaches completion but exits non-zero on pre-existing tutorial 19 DID unknown-target warnings. Those warnings are addressed separately in PR #572.

Security / privacy

Confirmed: no secrets or PII in this PR.

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.

Clarify DifferenceInDifferences.predict() support contract

1 participant