Repository navigation
BUG: Allow scalar offset and exposure in count models - #11212
Open
xihaian251 wants to merge 2 commits into
Open
xihaian251 wants to merge 2 commits into
xihaian251 wants to merge 2 commits into
Conversation
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.
The count-model input check accesses
shape[0]even for zero-dimensional offset or exposure arrays. Skip the first-axis length check for scalar inputs while retaining the existing validation for non-scalar arrays. This preserves the existing broadcasting and exposure transformation semantics.Regression tests cover scalar and zero-dimensional inputs across Poisson, NegativeBinomial, GeneralizedPoisson and NegativeBinomialP, constant-vector equivalence, Poisson fitting and rejection of incorrect vector lengths (28 passed).
NumPy's guide.
AI Disclosure<!--
REQUIRED. Do not delete or rewrite this section. The "AI Policy Disclosure Check"
CI job fails until exactly one of the two boxes below is ticked ([x]).
This applies to every pull request, including pull requests opened by an AI agent,
opened with
gh pr create --body ...(which does not use this template), or whereyou replace the text above with your own description. In those cases, copy this whole
section, unchanged, into your description.
Keep this in sync with the copy in .github/workflows/ai-policy-check.yml.
-->
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):
Qoder, ChatGPT, Wolfram Language.Used for:
Qoder (source investigation, implementation, regression tests, debugging and coverage checks); ChatGPT (technical review, mathematical cross-checking and preparation of private review notes); Wolfram Language (symbolic and numerical cross-checking).I have personally read, understood, and can explain every line of this diff, and
have verified the statistical/numerical correctness of the change.
Details
Notes:
needed for doc changes.
then show that it is fixed with the new code.
verify your changes are well formatted by running
ruffis installed. While passing this test is not required, it is good practice and it helpimprove code quality in
statsmodels.AI Policy for what disclosure
and review is expected of you before submitting.