diff --git a/pymc/step_methods/metropolis.py b/pymc/step_methods/metropolis.py index ba5cf365c41..463464f0353 100644 --- a/pymc/step_methods/metropolis.py +++ b/pymc/step_methods/metropolis.py @@ -707,11 +707,11 @@ class DEMetropolis(PopulationArrayStepShared): Some measure of variance to parameterize proposal distribution proposal_dist: function Function that returns zero-mean deviates when parameterized with - S (and n). Defaults to Uniform(-S,+S). + S (and n). Defaults to NormalProposal(S). scaling: scalar or array Initial scale factor for epsilon. Defaults to 0.001 tune: str - Which hyperparameter to tune. Defaults to None, but can also be 'scaling' or 'lambda'. + Which hyperparameter to tune. Defaults to 'scaling', but can also be 'lambda' or None. tune_interval: int The frequency of tuning. Defaults to 100 iterations. model: PyMC Model @@ -748,7 +748,7 @@ def __init__( proposal_dist=None, lamb=None, scaling=0.001, - tune=None, + tune: Optional[str] = "scaling", tune_interval=100, model=None, mode=None, @@ -770,7 +770,7 @@ def __init__( if proposal_dist is not None: self.proposal_dist = proposal_dist(S) else: - self.proposal_dist = UniformProposal(S) + self.proposal_dist = NormalProposal(S) self.scaling = np.atleast_1d(scaling).astype("d") if lamb is None: @@ -851,11 +851,11 @@ class DEMetropolisZ(ArrayStepShared): Some measure of variance to parameterize proposal distribution proposal_dist: function Function that returns zero-mean deviates when parameterized with - S (and n). Defaults to Uniform(-S,+S). + S (and n). Defaults to NormalProposal(S). scaling: scalar or array Initial scale factor for epsilon. Defaults to 0.001 tune: str - Which hyperparameter to tune. Defaults to 'lambda', but can also be 'scaling' or None. + Which hyperparameter to tune. Defaults to 'scaling', but can also be 'lambda' or None. tune_interval: int The frequency of tuning. Defaults to 100 iterations. tune_drop_fraction: float @@ -869,7 +869,7 @@ class DEMetropolisZ(ArrayStepShared): References ---------- - .. [Braak2006] Cajo C.F. ter Braak (2006). + .. [Braak2008] Cajo C.F. ter Braak (2008). Differential Evolution Markov Chain with snooker updater and fewer chains. Statistics and Computing `link `__ @@ -895,7 +895,7 @@ def __init__( proposal_dist=None, lamb=None, scaling=0.001, - tune="lambda", + tune: Optional[str] = "scaling", tune_interval=100, tune_drop_fraction: float = 0.9, model=None, @@ -917,7 +917,7 @@ def __init__( if proposal_dist is not None: self.proposal_dist = proposal_dist(S) else: - self.proposal_dist = UniformProposal(S) + self.proposal_dist = NormalProposal(S) self.scaling = np.atleast_1d(scaling).astype("d") if lamb is None: diff --git a/pymc/tests/step_methods/test_metropolis.py b/pymc/tests/step_methods/test_metropolis.py index c50a7c8e14d..9544a64e8df 100644 --- a/pymc/tests/step_methods/test_metropolis.py +++ b/pymc/tests/step_methods/test_metropolis.py @@ -138,6 +138,9 @@ def test_demcmc_tune_parameter(self): pm.Normal("n", mu=0, sigma=1, size=(2, 3)) step = DEMetropolis() + assert step.tune == "scaling" + + step = DEMetropolis(tune=None) assert step.tune is None step = DEMetropolis(tune="scaling")