From 4d4912dd474941d069827d886e15a874386b7600 Mon Sep 17 00:00:00 2001 From: Ashish Date: Fri, 29 Jan 2021 22:14:39 +0530 Subject: [PATCH 1/8] one class docs updated --- pymc3/step_methods/metropolis.py | 36 +++++++++++++------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/pymc3/step_methods/metropolis.py b/pymc3/step_methods/metropolis.py index fa5040e5a1..ce902f395e 100644 --- a/pymc3/step_methods/metropolis.py +++ b/pymc3/step_methods/metropolis.py @@ -95,28 +95,7 @@ def __call__(self, num_draws=None): class Metropolis(ArrayStepShared): - """ - Metropolis-Hastings sampling step - - Parameters - ---------- - vars: list - List of variables for sampler - S: standard deviation or covariance matrix - 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 normal. - scaling: scalar or array - Initial scale factor for proposal. Defaults to 1. - tune: bool - Flag for tuning. Defaults to True. - tune_interval: int - The frequency of tuning. Defaults to 100 iterations. - model: PyMC Model - Optional model for sampling step. Defaults to None (taken from context). - mode: string or `Mode` instance. - compilation mode passed to Theano functions + """Metropolis-Hastings sampling step """ name = "metropolis" @@ -144,6 +123,19 @@ def __init__( mode=None, **kwargs ): + """Metropolis-Hastings sampling step + + Arguments: + vars -- List of variables for sampler (default None) + S -- Some measure of variance to parameterize proposal distribution (default None) + proposal_dist -- Function that returns zero-mean deviates when parameterized with + S (and n). Defaults to normal. (default None) + scaling -- Initial scale factor for proposal. (default 1.0) + tune -- Flag for tuning. (default True) + tune_interval -- The frequency of tuning. (default 100) + model -- Optional model for sampling step. Defaults to None (taken from context). (default None) + mode -- compilation mode passed to Theano functions. (default None) + """ model = pm.modelcontext(model) From 3bad6fa1788c4c7f7173d451933a51089e911732 Mon Sep 17 00:00:00 2001 From: Ashish Date: Fri, 29 Jan 2021 22:17:40 +0530 Subject: [PATCH 2/8] Updated with docs with PEP 257 in one class --- pymc3/step_methods/metropolis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymc3/step_methods/metropolis.py b/pymc3/step_methods/metropolis.py index ce902f395e..020674713a 100644 --- a/pymc3/step_methods/metropolis.py +++ b/pymc3/step_methods/metropolis.py @@ -133,7 +133,7 @@ def __init__( scaling -- Initial scale factor for proposal. (default 1.0) tune -- Flag for tuning. (default True) tune_interval -- The frequency of tuning. (default 100) - model -- Optional model for sampling step. Defaults to None (taken from context). (default None) + model -- Optional model for sampling step. Defaults to None (taken from context).(default None) mode -- compilation mode passed to Theano functions. (default None) """ From 4e9a1de2b1c812d4d98acf0c1d8f6472f211cdb0 Mon Sep 17 00:00:00 2001 From: Ashish Date: Fri, 29 Jan 2021 22:19:03 +0530 Subject: [PATCH 3/8] Updated with docs with PEP 257 in one class --- pymc3/step_methods/metropolis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymc3/step_methods/metropolis.py b/pymc3/step_methods/metropolis.py index 020674713a..e02667f2f6 100644 --- a/pymc3/step_methods/metropolis.py +++ b/pymc3/step_methods/metropolis.py @@ -133,7 +133,7 @@ def __init__( scaling -- Initial scale factor for proposal. (default 1.0) tune -- Flag for tuning. (default True) tune_interval -- The frequency of tuning. (default 100) - model -- Optional model for sampling step. Defaults to None (taken from context).(default None) + model -- Optional model for sampling step. Defaults to None (taken from context). (default None) mode -- compilation mode passed to Theano functions. (default None) """ From 763652411bf47fb564bb1b6b865717e64f966738 Mon Sep 17 00:00:00 2001 From: Ashish <54330052+ashish-hacker@users.noreply.github.com> Date: Sat, 30 Jan 2021 10:06:44 +0530 Subject: [PATCH 4/8] updated --- pymc3/step_methods/metropolis.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/pymc3/step_methods/metropolis.py b/pymc3/step_methods/metropolis.py index e02667f2f6..f0784a23a0 100644 --- a/pymc3/step_methods/metropolis.py +++ b/pymc3/step_methods/metropolis.py @@ -96,6 +96,26 @@ def __call__(self, num_draws=None): class Metropolis(ArrayStepShared): """Metropolis-Hastings sampling step + + Parameters + ---------- + vars: list + List of variables for sampler + S: standard deviation or covariance matrix + 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 normal. + scaling: scalar or array + Initial scale factor for proposal. Defaults to 1. + tune: bool + Flag for tuning. Defaults to True. + tune_interval: int + The frequency of tuning. Defaults to 100 iterations. + model: PyMC Model + Optional model for sampling step. Defaults to None (taken from context). + mode: string or `Mode` instance. + compilation mode passed to Theano functions """ name = "metropolis" @@ -123,7 +143,7 @@ def __init__( mode=None, **kwargs ): - """Metropolis-Hastings sampling step + """Create an instance of a Metropolis stepper Arguments: vars -- List of variables for sampler (default None) From 24d66713dfd75448ace4d7b02210a093a69d8ced Mon Sep 17 00:00:00 2001 From: Ashish Date: Sat, 30 Jan 2021 10:14:17 +0530 Subject: [PATCH 5/8] update --- pymc3/step_methods/metropolis.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/pymc3/step_methods/metropolis.py b/pymc3/step_methods/metropolis.py index e02667f2f6..91c667dd06 100644 --- a/pymc3/step_methods/metropolis.py +++ b/pymc3/step_methods/metropolis.py @@ -96,6 +96,26 @@ def __call__(self, num_draws=None): class Metropolis(ArrayStepShared): """Metropolis-Hastings sampling step + + Parameters + ---------- + vars: list + List of variables for sampler + S: standard deviation or covariance matrix + 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 normal. + scaling: scalar or array + Initial scale factor for proposal. Defaults to 1. + tune: bool + Flag for tuning. Defaults to True. + tune_interval: int + The frequency of tuning. Defaults to 100 iterations. + model: PyMC Model + Optional model for sampling step. Defaults to None (taken from context). + mode: string or `Mode` instance. + compilation mode passed to Theano functions """ name = "metropolis" @@ -123,7 +143,7 @@ def __init__( mode=None, **kwargs ): - """Metropolis-Hastings sampling step + """Create an instance of a Metropolis stepper Arguments: vars -- List of variables for sampler (default None) From 0c450c173a89e29322f5a9d6c093dcf039e471b1 Mon Sep 17 00:00:00 2001 From: Ashish Date: Sat, 30 Jan 2021 10:33:18 +0530 Subject: [PATCH 6/8] Update --- pymc3/step_methods/metropolis.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/pymc3/step_methods/metropolis.py b/pymc3/step_methods/metropolis.py index d6b376f813..8349190b85 100644 --- a/pymc3/step_methods/metropolis.py +++ b/pymc3/step_methods/metropolis.py @@ -95,7 +95,28 @@ def __call__(self, num_draws=None): class Metropolis(ArrayStepShared): - """Metropolis-Hastings sampling step""" + """Metropolis-Hastings sampling step + + Parameters + ---------- + vars: list + List of variables for sampler + S: standard deviation or covariance matrix + 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 normal. + scaling: scalar or array + Initial scale factor for proposal. Defaults to 1. + tune: bool + Flag for tuning. Defaults to True. + tune_interval: int + The frequency of tuning. Defaults to 100 iterations. + model: PyMC Model + Optional model for sampling step. Defaults to None (taken from context). + mode: string or `Mode` instance. + compilation mode passed to Theano functions + """ name = "metropolis" @@ -122,7 +143,7 @@ def __init__( mode=None, **kwargs ): - """Metropolis-Hastings sampling step + """Create an instance of a Metropolis stepper Arguments: vars -- List of variables for sampler (default None) From f938eb7ea7ed5a712f42c1cc63bd46b2315958d4 Mon Sep 17 00:00:00 2001 From: Ashish Date: Sat, 30 Jan 2021 16:32:43 +0530 Subject: [PATCH 7/8] update --- pymc3/step_methods/metropolis.py | 52 ++++++++++++-------------------- 1 file changed, 20 insertions(+), 32 deletions(-) diff --git a/pymc3/step_methods/metropolis.py b/pymc3/step_methods/metropolis.py index 8349190b85..1fa1b1a40f 100644 --- a/pymc3/step_methods/metropolis.py +++ b/pymc3/step_methods/metropolis.py @@ -95,28 +95,7 @@ def __call__(self, num_draws=None): class Metropolis(ArrayStepShared): - """Metropolis-Hastings sampling step - - Parameters - ---------- - vars: list - List of variables for sampler - S: standard deviation or covariance matrix - 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 normal. - scaling: scalar or array - Initial scale factor for proposal. Defaults to 1. - tune: bool - Flag for tuning. Defaults to True. - tune_interval: int - The frequency of tuning. Defaults to 100 iterations. - model: PyMC Model - Optional model for sampling step. Defaults to None (taken from context). - mode: string or `Mode` instance. - compilation mode passed to Theano functions - """ + """Metropolis-Hastings sampling step""" name = "metropolis" @@ -145,16 +124,25 @@ def __init__( ): """Create an instance of a Metropolis stepper - Arguments: - vars -- List of variables for sampler (default None) - S -- Some measure of variance to parameterize proposal distribution (default None) - proposal_dist -- Function that returns zero-mean deviates when parameterized with - S (and n). Defaults to normal. (default None) - scaling -- Initial scale factor for proposal. (default 1.0) - tune -- Flag for tuning. (default True) - tune_interval -- The frequency of tuning. (default 100) - model -- Optional model for sampling step. Defaults to None (taken from context). (default None) - mode -- compilation mode passed to Theano functions. (default None) + Parameters + ---------- + vars: list + List of variables for sampler + S: standard deviation or covariance matrix + 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 normal. + scaling: scalar or array + Initial scale factor for proposal. Defaults to 1. + tune: bool + Flag for tuning. Defaults to True. + tune_interval: int + The frequency of tuning. Defaults to 100 iterations. + model: PyMC Model + Optional model for sampling step. Defaults to None (taken from context). + mode: string or `Mode` instance. + compilation mode passed to Theano functions """ model = pm.modelcontext(model) From dbdeeaa82f399949e45803cb241f49a0ff832bfe Mon Sep 17 00:00:00 2001 From: Thomas Wiecki Date: Sun, 31 Jan 2021 21:14:07 +0100 Subject: [PATCH 8/8] Update pymc3/step_methods/metropolis.py --- pymc3/step_methods/metropolis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymc3/step_methods/metropolis.py b/pymc3/step_methods/metropolis.py index 1fa1b1a40f..76804db2f8 100644 --- a/pymc3/step_methods/metropolis.py +++ b/pymc3/step_methods/metropolis.py @@ -141,7 +141,7 @@ def __init__( The frequency of tuning. Defaults to 100 iterations. model: PyMC Model Optional model for sampling step. Defaults to None (taken from context). - mode: string or `Mode` instance. + mode: string or `Mode` instance. compilation mode passed to Theano functions """