Skip to content

Conversation

@Tusharjamdade
Copy link

Reference Issues/PRs

Fixes #689

What does this implement/fix? Explain your changes.

Adds a mechanism to inject distribution-specific closed-form formulas into method docstrings (pdf, log_pdf, cdf, pmf) via class-level hooks, handled automatically in BaseDistribution.__init_subclass__.

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

What should a reviewer concentrate their feedback on?

  • Docstring injection logic
  • Method cloning safety
  • Inheritance behavior

Did you add any tests for the change?

Any other comments?

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.

Copy link
Collaborator

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Could you kindly:

  • implement this for a few distributions so we see it works
  • also ensure that the docstring renders properly where no formulae are added, i.e., the value of the hook is None
  • add this to all public methods, e.g., energy, log_pmf, etc.

@Tusharjamdade
Copy link
Author

Hi @fkiraly, please take a look.

@Tusharjamdade Tusharjamdade requested a review from fkiraly January 11, 2026 18:59

# documentation hooks for formula injection
_pdf_formula_doc = r"""
**Closed form**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you include the header "closed form"?

@fkiraly
Copy link
Collaborator

fkiraly commented Jan 14, 2026

this didn't work. Please check the doc build yourself before you ask for review. You can look at it by clicking on the doc build PR, or by building locally. This is how the result looks like:

image

Also, code formatting is failing. See https://www.sktime.net/en/stable/developer_guide/coding_standards.html for how to set it up locally.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DOC] design distribution specific documentation override for methods

2 participants