From 9c99e10a745d2534f62745e56bb94df0aa8bee6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20Kir=C3=A1ly?= Date: Sat, 20 Apr 2024 12:03:16 +0100 Subject: [PATCH] [BUG] fixes to lognormal distribution (#261) Fixes small things relate dto the `LogNormal` distribution: * fixed parameter names in docstring * clarification of parameterization * `icdf` was incorrect, fixed that --- skpro/distributions/lognormal.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/skpro/distributions/lognormal.py b/skpro/distributions/lognormal.py index ad81b8af3..135afa704 100644 --- a/skpro/distributions/lognormal.py +++ b/skpro/distributions/lognormal.py @@ -11,14 +11,19 @@ class LogNormal(BaseDistribution): - """Log-Normal distribution (skpro native). + r"""Log-Normal distribution (skpro native). + + Parameterized by mean and standard deviation of the logarithm of the distribution, + :math:`\mu` and :math:`\sigma`, respectively, such that the cdf + + .. math:: F(x) = \frac{1}{2} + \frac{1}{2} \text{erf}\left(\frac{\log(x) - \mu}{\sigma \sqrt{2}}\right) # noqa E501 Parameters ---------- - mean : float or array of float (1D or 2D) - mean of the logarithm of the distribution - sd : float or array of float (1D or 2D), must be positive - standard deviation the logarithm of the distribution + mu : float or array of float (1D or 2D) + mean of the logarithm of the distribution, :math:`\mu` above + sigma : float or array of float (1D or 2D), must be positive + standard deviation the logarithm of the distribution, :math:`\sigma` above index : pd.Index, optional, default = RangeIndex columns : pd.Index, optional, default = RangeIndex @@ -148,7 +153,7 @@ def ppf(self, p): """Quantile function = percent point function = inverse cdf.""" d = self.loc[p.index, p.columns] icdf_arr = d.mu + d.sigma * np.sqrt(2) * erfinv(2 * p.values - 1) - icdf_arr = np.exp(self._sigma * icdf_arr) + icdf_arr = np.exp(icdf_arr) return pd.DataFrame(icdf_arr, index=p.index, columns=p.columns) @classmethod