Skip to content

Commit da20635

Browse files
committed
fixed docstrings for ArrayStep, ArrayStepShared, PopulationArrayStepShared, link_population, and metrop_select
1 parent c8d83ca commit da20635

File tree

1 file changed

+42
-25
lines changed

1 file changed

+42
-25
lines changed

pymc/step_methods/arraystep.py

Lines changed: 42 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,16 @@ class ArrayStep(BlockedStep):
3232
3333
Parameters
3434
----------
35-
vars: list
35+
vars : list
3636
List of value variables for sampler.
37-
fs: list of logp PyTensor functions
38-
allvars: Boolean (default False)
39-
blocked: Boolean (default True)
40-
rng: RandomGenerator
41-
An object that can produce be used to produce the step method's
37+
fs : list
38+
Logp PyTensor functions.
39+
allvars : bool, default False
40+
Whether to pass all model variables to the logp functions.
41+
blocked : bool, default True
42+
Whether variables are updated jointly or separately.
43+
rng : RandomGenerator
44+
An object that can be used to produce the step method's
4245
:py:class:`~numpy.random.Generator` object. Refer to
4346
:py:func:`pymc.util.get_random_generator` for more information.
4447
"""
@@ -90,11 +93,14 @@ def __init__(self, vars, shared, blocked=True, rng: RandomGenerator = None):
9093
9194
Parameters
9295
----------
93-
vars: list of sampling value variables
94-
shared: dict of PyTensor variable -> shared variable
95-
blocked: Boolean (default True)
96-
rng: RandomGenerator
97-
An object that can produce be used to produce the step method's
96+
vars : list
97+
Sampling value variables.
98+
shared : dict
99+
PyTensor variable -> shared variable.
100+
blocked : bool, default True
101+
Whether variables are updated jointly or separately.
102+
rng : RandomGenerator
103+
An object that can be used to produce the step method's
98104
:py:class:`~numpy.random.Generator` object. Refer to
99105
:py:func:`pymc.util.get_random_generator` for more information.
100106
"""
@@ -138,11 +144,14 @@ def __init__(self, vars, shared, blocked=True, rng: RandomGenerator = None):
138144
139145
Parameters
140146
----------
141-
vars: list of sampling value variables
142-
shared: dict of PyTensor variable -> shared variable
143-
blocked: Boolean (default True)
144-
rng: RandomGenerator
145-
An object that can produce be used to produce the step method's
147+
vars : list
148+
Sampling value variables.
149+
shared : dict
150+
PyTensor variable -> shared variable.
151+
blocked : bool, default True
152+
Whether variables are updated jointly or separately.
153+
rng : RandomGenerator
154+
An object that can be used to produce the step method's
146155
:py:class:`~numpy.random.Generator` object. Refer to
147156
:py:func:`pymc.util.get_random_generator` for more information.
148157
"""
@@ -156,9 +165,11 @@ def link_population(self, population, chain_index):
156165
157166
Parameters
158167
----------
159-
population: list of Points. (The elements of this list must be
160-
replaced with current chain states in every iteration.)
161-
chain_index: int of the index of this sampler in the population
168+
population : list of Points
169+
The elements of this list must be replaced with current chain
170+
states in every iteration.
171+
chain_index : int
172+
The index of this sampler in the population.
162173
"""
163174
self.population = population
164175
self.this_chain = chain_index
@@ -216,15 +227,21 @@ def metrop_select(
216227
217228
Parameters
218229
----------
219-
mr: float, Metropolis acceptance rate
220-
q: proposed sample
221-
q0: current sample
222-
rng: numpy.random.Generator
223-
A random number generator object
230+
mr : float
231+
Metropolis acceptance rate.
232+
q : np.ndarray
233+
Proposed sample.
234+
q0 : np.ndarray
235+
Current sample.
236+
rng : numpy.random.Generator
237+
A random number generator object.
224238
225239
Returns
226240
-------
227-
q or q0
241+
np.ndarray
242+
The accepted sample (`q` or `q0`).
243+
bool
244+
Whether the proposed `q` was accepted.
228245
"""
229246
# Compare acceptance ratio to uniform random number
230247
# TODO XXX: This `uniform` is not given a model-specific RNG state, which

0 commit comments

Comments
 (0)