diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index a1ea98ed84a..cc8d1e5010a 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -8,7 +8,7 @@ - `GLM.from_formula` and `LinearComponent.from_formula` can extract variables from the calling scope. Customizable via the new `eval_env` argument. Fixing #3382. ### Maintenance - +- Add `sigma`, `tau`, and `sd` to signature of `NormalMixture`. - All occurances of `sd` as a parameter name have been renamed to `sigma`. `sd` will continue to function for backwards compatibility. - Made `BrokenPipeError` for parallel sampling more verbose on Windows. - Added the `broadcast_distribution_samples` function that helps broadcasting arrays of drawn samples, taking into account the requested `size` and the inferred distribution shape. This sometimes is needed by distributions that call several `rvs` separately within their `random` method, such as the `ZeroInflatedPoisson` (Fix issue #3310). diff --git a/pymc3/distributions/mixture.py b/pymc3/distributions/mixture.py index 434f7dde1a1..ee18fed8b76 100644 --- a/pymc3/distributions/mixture.py +++ b/pymc3/distributions/mixture.py @@ -564,12 +564,10 @@ class NormalMixture(Mixture): Note: You only have to pass in sigma or tau, but not both. """ - def __init__(self, w, mu, comp_shape=(), *args, **kwargs): - if 'sd' in kwargs.keys(): - kwargs['sigma'] = kwargs.pop('sd') - - _, sigma = get_tau_sigma(tau=kwargs.pop('tau', None), - sigma=kwargs.pop('sigma', None)) + def __init__(self, w, mu, sigma=None, tau=None, sd=None, comp_shape=(), *args, **kwargs): + if sd is not None: + sigma = sd + _, sigma = get_tau_sigma(tau=tau, sigma=sigma) self.mu = mu = tt.as_tensor_variable(mu) self.sigma = self.sd = sigma = tt.as_tensor_variable(sigma)