DOC: Fix documentation formatting, LaTeX, parameter metadata, and type declarations in continuous distributions
Issue with current documentation:
I am really sorry I used ChatGPT for formatting the issue as there were many fixes it was very hard for me to be clear and clean with my issue text; thus, I used it the fixes are mine so are the issues I found with the docs...
Description
I found a few small problems in the docstrings inside pymc/distributions/continuous.py. Each one is listed below with the distribution name, the exact text, and a suggested fix.
1. AsymmetricLaplace — broken LaTeX in the pdf equation
The .. math:: block uses \\b, which is not valid LaTeX and causes the equation to render incorrectly (overlapping symbols) on the docs page.
Current:
f(x|\\b,\kappa,\mu) =
\left({\frac{\\b}{\kappa + 1/\kappa}}\right)\,e^{-(x-\mu)\\b\,s\kappa ^{s}}Suggested fix:
f(x \mid b, \kappa, \mu) =
\left(\frac{b}{\kappa + 1/\kappa}\right)
\exp\left(-(x-\mu) \, b \, s \, \kappa^{s}\right)2. Exponential — missing space and missing optional on scale
Current:
scale: tensor_like of float
Alternative parameter (scale = 1/lam).The missing space before : isn't correct also, tensor_like and float doens't render as clickable type links — on the live docs page, lam right above it shows tensor_like and float as underlined links, but scale shows the same text as plain, unlinked bold text.
Suggested fix:
scale : tensor_like of float, optional
Alternative parameter (scale = 1/lam).3. ExGaussian — sigma and nu missing optional/default
Current:
sigma : tensor_like of float
Standard deviation of the normal distribution (sigma > 0).
nu : tensor_like of float
Mean of the exponential distribution (nu > 0).Neither parameter states whether it's required or has a default, unlike mu above them (default 0).
4. SkewStudentT — sigma/lam defaults only in prose, not the type field
Current:
sigma : tensor_like of float
Scale parameter (sigma > 0). ... Defaults to 1.
lam : tensor_like of float, optional
Scale parameter (lam > 0). ... Defaults to 1.Both say "Defaults to 1" in text, but sigma has no marking and lam says optional instead of default 1.
Suggested fix:
sigma : tensor_like of float, default 1
...
lam : tensor_like of float, default 1
...5. Weibull — alpha/beta missing tensor_like of
Current:
alpha : float
Shape parameter (alpha > 0).
beta : float
Scale parameter (beta > 0).Suggested fix:
alpha : tensor_like of float
Shape parameter (alpha > 0).
beta : tensor_like of float
Scale parameter (beta > 0).6. Interpolated — typo, raw math text, inconsistent term
Current:
The probability density function values don not have to be normalized,
as the interpolated density is any way normalized to make the total
probability equal to $1$.
Both parameters x_points and values pdf_points are not variables,
but plain array-like objects, so they are constant and cannot be sampled.Issues:
- "don not" should be "do not"
$1$shows as raw text instead of rendering
Suggested fix:
The probability density function values do not have to be normalized,
as the interpolated density is normalized automatically so that the
total probability equals 1.
The parameters x_points and pdf_points are plain arrays, not variables,
so they are constant and cannot be sampled.Question
For Interpolated's x_points and pdf_points — should array_like be replaced with tensor_like to match the type alias used elsewhere in this file, or is array_like intentional here since the docstring says these must be non-symbolic (i.e., not PyTensor tensors)? Happy to update the fix either way once I know which is correct.
I'm happy to open a PR for these once confirmed, and can split into separate PRs if that's easier to review.
Idea or request for content:
No response
Source: pymc-devs/pymc