Skip to content

[ENH] Remove redundant method overrides in Skellam and FDist#963

Open
ANANYA542 wants to merge 1 commit intosktime:mainfrom
ANANYA542:mnt/remove-redundant-overrides-clean
Open

[ENH] Remove redundant method overrides in Skellam and FDist#963
ANANYA542 wants to merge 1 commit intosktime:mainfrom
ANANYA542:mnt/remove-redundant-overrides-clean

Conversation

@ANANYA542
Copy link

Description

Both Skellam and FDist distributions extend _ScipyAdapter and implement _get_scipy_param() correctly. However, they both manually overrode _pmf / _pdf, _cdf, _ppf, _mean, and _var with logic that is completely identical to what the adapter already provides natively.
For example, Skellam._pmf manually does:
For example, Skellam._pmf manually does:
def _pmf(self, x):
mu1 = self._bc_params["mu1"]
mu2 = self._bc_params["mu2"]
return skellam.pmf(x, mu1, mu2)
But _ScipyAdapter._pmf already does exactly this via _get_scipy_param() . Since Skellam._get_scipy_param() returns [mu1, mu2], {}, both paths are mathematically identical. These overrides add roughly 25 redundant lines per file with no functional difference whatsoever. This commit removes those redundant methods, letting the _ScipyAdapter
base class handle them as designed, which significantly reduces code duplication. I validated this locally by removing the overrides and confirming identical outputs before and after.

Reference Issues/PRs

Fixes #944

What does this implement/fix? Explain your changes.

This PR deletes redundant core distribution method overrides from skellam.py and f.py (or f_dist.py), allowing them to cleanly inherit the exact same behavior from _ScipyAdapter.

Does your contribution introduce a new dependency? If yes, which one?

no

What should a reviewer concentrate their feedback on?

  1. Confirming that the removed methods were indeed exactly duplicating the native _ScipyAdapter behavior.
  2. Verifying the CI tests still pass successfully using the inherited adapter methods.

Did you add any tests for the change?

No new tests are required because the existing distribution tests in the CI pipeline automatically verify that mean, var,pdf/
pmf, cdf and ppf work correctly, ensuring no functionality is broken by relying on the base class.

Any other comments?

The screenshot for the fix has been attatched
Screenshot 2026-03-17 at 11 10 11 PM

PR checklist

For all contributions
  • I've added myself to the list of contributors with any new badges I've earned :-)
    How to: add yourself to the all-contributors file in the skpro root directory (not the CONTRIBUTORS.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 plus code if you also fixed the bug in the PR).maintenance - CI, test framework, release.
    See here for full badge reference
  • The PR title starts with either [ENH], [MNT], [DOC], or [BUG]. [BUG] - bugfix, [MNT] - CI, test framework, [ENH] - adding or improving code, [DOC] - writing or improving documentation or docstrings.
For new estimators
  • I've added the estimator to the API reference - in docs/source/api_reference/taskname.rst, follow the pattern.
  • I've added one or more illustrative usage examples to the docstring, in a pydocstyle compliant Examples section.
  • If the estimator relies on a soft dependency, I've set the python_dependencies tag and ensured
    dependency isolation, see the estimator dependencies guide.

Both Skellam and FDist extend _ScipyAdapter and implement
_get_scipy_param() correctly. However, they both manually
overrode _pmf/_pdf, _cdf, _ppf, _mean, and _var with logic
that is identical to what the adapter already provides natively.

This commit removes those redundant methods, letting the
base class handle them as designed, reducing code duplication.

Fixes sktime#944
@fkiraly fkiraly added enhancement module:probability&simulation probability distributions and simulators labels Mar 17, 2026
@fkiraly fkiraly changed the title [MNT] Remove redundant method overrides in Skellam and FDist [ENH] Remove redundant method overrides in Skellam and FDist Mar 17, 2026
@ANANYA542
Copy link
Author

@fkiraly -if you could review this pr and let me know if some changes or explanation under the same are required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement module:probability&simulation probability distributions and simulators

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENH] Remove redundant scipy method overrides in Skellam and FDist distributions

2 participants