[DOC] Add formula docs for Uniform distribution - #1123
Open
Vidit-lab wants to merge 1 commit into
Open
Conversation
Vidit-lab
requested review from
felipeangelimvieira and
fkiraly
as code owners
August 15, 2026 06:47
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
Part of #1120
What does this implement/fix? Explain your changes.
Populates the
_formula_docsdictionary forUniform(skpro/distributions/uniform.py) covering all seven exact methods (pdf,log_pdf,cdf,ppf,mean,var,energy).Refactors standalone formula attributes (
_pdf_formula_doc,_log_pdf_formula_doc, and_cdf_formula_doc) into the single_formula_docsstructure.Mathematical References & Derivations
Since the closed-form math for
_pdf,_log_pdf,_cdf,_ppf,_mean,_var,_energy_self, and_energy_xis already implemented inuniform.py, the formulas in_formula_docsdocument these existing operations:Standard Properties (
pdf,log_pdf,cdf,ppf,mean,var):Self-Energy ($\mathbb{E}[|X - Y|]$ ):
For$X, Y \stackrel{\text{i.i.d.}}{\sim} U(a,b)$ with joint density $f(x, y) = \frac{1}{(b - a)^2}$ :
Exploiting symmetry across$x = y$ :
Matches
_energy_selfreturn value(upper - lower) / 3.Point Energy ($\mathbb{E}[|X - x|]$ ):
Evaluated for constant$x$ :
For$x \in [a, b]$ , splitting the integral at $t = x$ yields:
For$x < a$ or $x > b$ , direct evaluation yields $\left| x - \frac{a + b}{2} \right|$ .
Matches
_energy_xlogic.Does your contribution introduce a new dependency? If yes, which one?
No.
What should a reviewer concentrate their feedback on?
_formula_docs.Did you add any tests for the change?
Added
UniformtoHOOKED_CLASSESintest_docstring_injection.py.Any other comments?
None.
PR checklist
skproroot directory.