Repository navigation
BUG: Do not change the flags dictionary passed to MLEModel.fit - #11062
Merged
Merged
Conversation
4 of 5 tasks
bashtage
force-pushed
the
wip-mlemodel-fit-flags-copy
branch
2 times, most recently
from
November 25, 2026 12:12
d00a254 to
b0d4ef4
Compare
MLEModel.fit adds its own entries (transformed, includes_fixed,
score_method, approx_complex_step, average and hessian_method) to the
dictionary of flags that it passes to the optimizer. It added them to the
dictionary given as `flags`, so that after mod.fit(flags=flags), an empty
dictionary held {'transformed': False, 'includes_fixed': False,
'score_method': 'approx', 'approx_complex_step': True, 'average': False}.
Changes
- fit adds its entries to a copy of `flags`.
Not changed
- The flags passed to the optimizer and the estimates.
Tests
- After fit, the dictionary given as `flags` (empty, or with an entry of
its own) is unchanged; the dictionary passed to the optimizer is a
different object with fit's entries and the caller's; the estimates
equal those without `flags`. Both cases fail on main.
bashtage
force-pushed
the
wip-mlemodel-fit-flags-copy
branch
from
November 25, 2026 18:38
b0d4ef4 to
c288d13
Compare
bashtage
marked this pull request as ready for review
November 25, 2026 19:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#11029 (the C10 coverage chunk) appends tests to the same test file, so whichever merges second needs a rebase (keep both test blocks). The other C10F PRs and #11043 also append to
test_mlemodel.py: keep every appended block.MLEModel.fit adds its own entries (transformed, includes_fixed,
score_method, approx_complex_step, average and hessian_method) to the
dictionary of flags that it passes to the optimizer. It added them to the
dictionary given as
flags, so that after mod.fit(flags=flags), an emptydictionary held {'transformed': False, 'includes_fixed': False,
'score_method': 'approx', 'approx_complex_step': True, 'average': False}.
Changes
flags.Not changed
Tests
After fit, the dictionary given as
flags(empty, or with an entry ofits own) is unchanged; the dictionary passed to the optimizer is a
different object with fit's entries and the caller's; the estimates
equal those without
flags. Both cases fail on main.tests added / passed.
code/documentation is well formatted.
properly formatted commit message. See
NumPy's guide.
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.
Tool(s): Claude Code (Claude Opus 5.5).
Used for: finding the bug in a contract audit, writing the fix and its tests, and checking them (tests failing on main, mutation check).
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