[BUG] Fix incorrect variance calculation and capability tagging in Hurdle#973
Open
ANANYA542 wants to merge 1 commit intosktime:mainfrom
Open
[BUG] Fix incorrect variance calculation and capability tagging in Hurdle#973ANANYA542 wants to merge 1 commit intosktime:mainfrom
ANANYA542 wants to merge 1 commit intosktime:mainfrom
Conversation
…act capabilities tag
Contributor
Author
|
Hi @fkiraly — just following up on this PR. If you could take some time to review it and let me know if any changes or explanation is required, I’d really appreciate it. |
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.
Reference Issues/PRs
fixes #972
What does this implement/fix? Explain your changes.
This PR fixes an issue in the
Hurdledistribution where the variance was being computed incorrectly.The current implementation uses
p * var_positive + p * (1 - p) * mean_positive, but the mean term should be squared. This was leading to significant underestimation of the variance. The formula has been corrected to use(mean_positive ** 2)in line with the law of total variance.I also updated how capability tags are determined. Previously,
Hurdlechecked the base distribution to decide whethermean/varare exact, but since it internally wraps the distribution usingLeftTruncated, those values are actually computed via numerical approximation. The tags now reflect this correctly by checking the truncated distribution instead.Does your contribution introduce a new dependency? If yes, which one?
No
What should a reviewer concentrate their feedback on?
Did you add any tests for the change?
I verified the fix using Monte Carlo simulation (100k samples), where the empirical variance now matches the analytical result within tolerance. No new formal unit tests have been added yet.
Any other comments?
A screenshot showing the before/after behavior has also been added for clarity.
PR checklist
For all contributions
How to: add yourself to the all-contributors file in the
skproroot directory (not theCONTRIBUTORS.md). Common badges:code- fixing a bug, or adding code logic.doc- writing or improving documentation or docstrings.bug- reporting or diagnosing a bug (get this pluscodeif you also fixed the bug in the PR).maintenance- CI, test framework, release.See here for full badge reference
For new estimators
docs/source/api_reference/taskname.rst, follow the pattern.Examplessection.python_dependenciestag and ensureddependency isolation, see the estimator dependencies guide.