From 7552bb137013986ed544102952b018c3458cd082 Mon Sep 17 00:00:00 2001 From: hyosubkim <32351455+hyosubkim@users.noreply.github.com> Date: Wed, 9 Nov 2022 16:44:05 -0500 Subject: [PATCH 1/2] Updated pymc.DiscreteWeibull docstring --- pymc/distributions/discrete.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/pymc/distributions/discrete.py b/pymc/distributions/discrete.py index ce88d8bd723..feaaf529293 100644 --- a/pymc/distributions/discrete.py +++ b/pymc/distributions/discrete.py @@ -462,15 +462,16 @@ def rng_fn(cls, rng, q, beta, size): class DiscreteWeibull(Discrete): - R"""Discrete Weibull log-likelihood + """Discrete Weibull log-likelihood. The discrete Weibull distribution is a flexible model of count data that can handle both over- and under-dispersion. The pmf of this distribution is - .. math:: f(x \mid q, \beta) = q^{x^{\beta}} - q^{(x + 1)^{\beta}} + .. math:: f(x \\mid q, \beta) = q^{x^{\beta}} - q^{(x + 1)^{\beta}} .. plot:: + :context: close-figs import matplotlib.pyplot as plt import numpy as np @@ -495,11 +496,20 @@ def DiscreteWeibull(q, b, x): plt.show() ======== ====================== - Support :math:`x \in \mathbb{N}_0` - Mean :math:`\mu = \sum_{x = 1}^{\infty} q^{x^{\beta}}` - Variance :math:`2 \sum_{x = 1}^{\infty} x q^{x^{\beta}} - \mu - \mu^2` + Support :math:`x \\in \\mathbb{N}_0` + Mean :math:`\\mu = \\sum_{x = 1}^{\\infty} q^{x^{\beta}}` + Variance :math:`2 \\sum_{x = 1}^{\\infty} x q^{x^{\beta}} - \\mu - \\mu^2` ======== ====================== + + Parameters + ---------- + q : tensor_like of float + Shape parameter (0 < q < 1). + beta : tensor_like of float + Shape parameter (beta > 0). + """ + rv_op = discrete_weibull @classmethod From 5967d1508db87367511af8d0a43eb1dd2352b2ad Mon Sep 17 00:00:00 2001 From: hyosubkim <32351455+hyosubkim@users.noreply.github.com> Date: Wed, 9 Nov 2022 21:00:38 -0500 Subject: [PATCH 2/2] address review comments --- pymc/distributions/discrete.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pymc/distributions/discrete.py b/pymc/distributions/discrete.py index feaaf529293..509ab7f7593 100644 --- a/pymc/distributions/discrete.py +++ b/pymc/distributions/discrete.py @@ -462,13 +462,13 @@ def rng_fn(cls, rng, q, beta, size): class DiscreteWeibull(Discrete): - """Discrete Weibull log-likelihood. + R"""Discrete Weibull log-likelihood. The discrete Weibull distribution is a flexible model of count data that can handle both over- and under-dispersion. The pmf of this distribution is - .. math:: f(x \\mid q, \beta) = q^{x^{\beta}} - q^{(x + 1)^{\beta}} + .. math:: f(x \mid q, \beta) = q^{x^{\beta}} - q^{(x + 1)^{\beta}} .. plot:: :context: close-figs @@ -496,9 +496,9 @@ def DiscreteWeibull(q, b, x): plt.show() ======== ====================== - Support :math:`x \\in \\mathbb{N}_0` - Mean :math:`\\mu = \\sum_{x = 1}^{\\infty} q^{x^{\beta}}` - Variance :math:`2 \\sum_{x = 1}^{\\infty} x q^{x^{\beta}} - \\mu - \\mu^2` + Support :math:`x \in \mathbb{N}_0` + Mean :math:`\mu = \sum_{x = 1}^{\infty} q^{x^{\beta}}` + Variance :math:`2 \sum_{x = 1}^{\infty} x q^{x^{\beta}} - \mu - \mu^2` ======== ====================== Parameters @@ -509,7 +509,6 @@ def DiscreteWeibull(q, b, x): Shape parameter (beta > 0). """ - rv_op = discrete_weibull @classmethod