ENH: fix HalfCauchy scipy mapping and add dedicated tests (towards #22)#954
ENH: fix HalfCauchy scipy mapping and add dedicated tests (towards #22)#954kunal14901 wants to merge 1 commit intosktime:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes the SciPy adapter parameter mapping for HalfCauchy so that beta is passed as SciPy’s scale kwarg (instead of being interpreted as loc via a positional arg), and adds focused regression tests to prevent reintroducing the issue.
Changes:
- Corrected
HalfCauchy._get_scipy_paramto return{"scale": beta}as keyword arguments. - Added
test_halfcauchy.pyto verify scalar parity withscipy.stats.halfcauchy(pdf,cdf,ppf), support behavior forx < 0, and DataFrame broadcasting/shape preservation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
skpro/distributions/halfcauchy.py |
Fixes the SciPy parameter mapping so beta is passed as scale. |
skpro/distributions/tests/test_halfcauchy.py |
Adds regression tests covering scalar parity, support for negative inputs, and DataFrame broadcasting/shape behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
|
Hi @fkiraly and @felipeangelimvieira , thanks for reviewing. fixes HalfCauchy scipy parameter mapping (scale=beta) |
Reference Issues/PRs
See #22
What does this implement/fix? Explain your changes.
This PR fixes scipy parameter mapping for
HalfCauchyand adds dedicated regression tests.Changes made:
Updated
HalfCauchy._get_scipy_paramto passbetaas scipy keyword argumentscale.return [beta], {}return [], {"scale": beta}Added
skpro/distributions/tests/test_halfcauchy.pywith focused tests for:scipy.stats.halfcauchyforpdf,cdf, andppfx < 0)Does your contribution introduce a new dependency? If yes, which one?
No, this PR does not introduce any new dependency.
What should a reviewer concentrate their feedback on?
_get_scipy_paramHalfCauchytestsDid you add any tests for the change?
Yes.
Added:
skpro/distributions/tests/test_halfcauchy.pyValidation:
test_all_distrs.pyfiltered toHalfCauchypassed (103 selected tests)Any other comments?
Submitted as part of my ESoC 2026 application contribution towards #22.
Happy to iterate quickly on feedback.
PR checklist
For all contributions
For new estimators