Skip to content

DOC: Follow up #10780 on the DistributedModel signature check, with tests - #10789

Merged
bashtage merged 2 commits into
statsmodels:mainfrom
bashtage:wip-distributed-gee-followup
Nov 18, 2026
Merged

bashtage merged 2 commits into
statsmodels:mainfrom
bashtage:wip-distributed-gee-followup

Conversation

@bashtage

Copy link
Copy Markdown
Member

Follow up to #10780 (DistributedModel with GEE, merged at 18:15 UTC on 18 November). The review of its last head left the points below: one docstring directive and tests for the branches of the new check that no test failed without. No change of the behavior of DistributedModel.

  • tests added / passed.
  • code/documentation is well formatted.
  • properly formatted commit message. See
    NumPy's guide.

Changes

  • DOC: the .. versionchanged:: 0.15.1 of DistributedModel.fit was the last block of the Raises section, so numpydoc read it as a second exception named .. versionchanged:: 0.15.1 (numpydoc.docscrape.FunctionDoc: Raises = [NotImplementedError, '.. versionchanged:: 0.15.1']) and Sphinx would show it as one. It is now below the summary line, above Parameters: Raises = [NotImplementedError], and the directive is in the extended summary.
  • TST: test_check_estimation_method_signature runs _check_estimation_method for OLS, a subclass with fit_regularized(self, **kwargs), a subclass with neither alpha nor **kwargs, GEE and RLM (which has no fit_regularized); test_fit_regularized_with_keywords_only fits the **kwargs subclass against OLS (equal to 1e-12, and to the reference values of test_fit_sequential); test_dummy_model_groups checks that the placeholder model of a GEE has the groups of init_kwds if there are any and one group otherwise.

Checks

  • Mutants of distributed_estimation.py, each applied alone. With the tests of main only (2) and (5) fail a test (test_gee_debiased_raises_before_fitting and test_gee_unregularized_naive) and (1), (3) and (4) survive; with this PR all five fail: (1) the VAR_KEYWORD branch removed: test_check_estimation_method_signature[_OLSKeywordFit-False] and test_fit_regularized_with_keywords_only fail; (2) the check never raises: the RLM, GEE and _OLSNoAlpha cases and test_gee_debiased_raises_before_fitting fail; (3) a model without fit_regularized is accepted: the RLM case fails; (4) the groups of init_kwds are overwritten: test_dummy_model_groups with groups=[3] fails; (5) no default groups: test_dummy_model_groups with no groups and test_gee_unregularized_naive fail.
  • test_distributed_estimation.py: 27 passed (Python 3.13, pandas 3.1.0). On the minimum versions (Python 3.10, NumPy 1.23.5, SciPy 1.8.1, pandas 1.5.3; the tree under test was the one imported) 26 passed and test_fit_joblib fails: its joblib worker processes import the environment's own editable copy of statsmodels, whose rebuild fails there; the same test fails the same way on unmodified main in that environment.
  • ruff check . and git diff --check pass. Sphinx was not run.

Not changed (from the review of #10780)

AI Disclosure

Contributions must comply with the statsmodels AI Policy.

Tick exactly one of the following. If AI tools were used, replace the <...>
placeholders in the second option with the tool name(s) and how the tool's output was
used.

  • No AI tools were used to develop this pull request.
  • AI tools were used.
    Tool(s): Claude Code (Claude Sonnet 5.5).
    Used for: reviewing BUG: Support GEE in DistributedModel #10780, and writing and checking the follow-up changes.
    I have personally read, understood, and can explain every line of this diff, and
    have verified the statistical/numerical correctness of the change.

🤖 Generated with Claude Code

bashtage and others added 2 commits November 18, 2026 18:19
The directive was the last block of the Raises section, which numpydoc reads as
a second exception named ".. versionchanged:: 0.15.1". Move it below the summary
line, above Parameters.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…edModel

No test failed when the VAR_KEYWORD branch of the fit_regularized signature
check, the branch for a model without fit_regularized, or the use of the groups
of init_kwds for the placeholder model was removed. Test the check for OLS, a
subclass with fit_regularized(**kwargs), a subclass without alpha, GEE and RLM,
fit the **kwargs subclass against OLS, and test the groups of the placeholder.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

class _OLSNoAlpha(OLS):
# neither an alpha parameter nor **kwargs
def fit_regularized(self, method="elastic_net"):
@bashtage
bashtage marked this pull request as ready for review November 18, 2026 18:33
@bashtage
bashtage merged commit 1387bd0 into statsmodels:main Nov 18, 2026
11 of 12 checks passed
@bashtage
bashtage deleted the wip-distributed-gee-followup branch November 20, 2026 10:56
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.

2 participants