diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 72faaaca..6dd3eff7 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,6 +7,15 @@ Changelog ========= +1.3.1 - 2021-04-12 +------------------ + +**Bug fix**: + +- :func:`quantcore.glm._distribution.unit_variance_derivative` is + evaluating a proper numexpr expression again (regression in 1.3.0). + + 1.3.0 - 2021-04-12 ------------------ diff --git a/src/quantcore/glm/_distribution.py b/src/quantcore/glm/_distribution.py index dc709fd5..6a9f3445 100644 --- a/src/quantcore/glm/_distribution.py +++ b/src/quantcore/glm/_distribution.py @@ -515,9 +515,9 @@ def unit_variance(self, mu: np.ndarray) -> np.ndarray: return numexpr.evaluate("mu ** p") def unit_variance_derivative(self, mu: np.ndarray) -> np.ndarray: - """Compute the derivative of the unit variance of a Tweedie distribution. + r"""Compute the derivative of the unit variance of a Tweedie distribution. - Equation: ``v(mu) = power * mu^(power-1)``. + Equation: :math:`v(\mu) = p \times \mu^{(p-1)}`. Parameters ---------- @@ -529,7 +529,7 @@ def unit_variance_derivative(self, mu: np.ndarray) -> np.ndarray: numpy.ndarray, shape (n_samples,) """ p = self.power # noqa: F841 - return numexpr.evaluate("p × mu^(p - 1)") + return numexpr.evaluate("p * mu ** (p - 1)") def unit_deviance(self, y, mu): """Get the deviance of each observation."""