@@ -80,7 +80,7 @@ def assign_step_methods(model, step=None, methods=(NUTS, HamiltonianMC, Metropol
80
80
81
81
82
82
def sample (draws , step = None , start = None , trace = None , chain = 0 , njobs = 1 , tune = None ,
83
- progressbar = True , model = None , random_seed = None ):
83
+ progressbar = True , model = None , random_seed = - 1 ):
84
84
"""
85
85
Draw a number of samples using the given step method.
86
86
Multiple step methods supported via compound step method
@@ -116,8 +116,8 @@ def sample(draws, step=None, start=None, trace=None, chain=0, njobs=1, tune=None
116
116
tune : int
117
117
Number of iterations to tune, if applicable (defaults to None)
118
118
progressbar : bool
119
- Whether or not to display a progress bar in the command line. The
120
- bar shows the percentage of completion, the sampling speed in
119
+ Whether or not to display a progress bar in the command line. The
120
+ bar shows the percentage of completion, the sampling speed in
121
121
samples per second (SPS), and the estimated remaining time until
122
122
completion ("expected time of arrival"; ETA).
123
123
model : Model (optional if in `with` context)
@@ -156,7 +156,7 @@ def sample(draws, step=None, start=None, trace=None, chain=0, njobs=1, tune=None
156
156
157
157
158
158
def _sample (draws , step = None , start = None , trace = None , chain = 0 , tune = None ,
159
- progressbar = True , model = None , random_seed = None ):
159
+ progressbar = True , model = None , random_seed = - 1 ):
160
160
sampling = _iter_sample (draws , step , start , trace , chain ,
161
161
tune , model , random_seed )
162
162
progress = progress_bar (draws )
@@ -170,7 +170,7 @@ def _sample(draws, step=None, start=None, trace=None, chain=0, tune=None,
170
170
171
171
172
172
def iter_sample (draws , step , start = None , trace = None , chain = 0 , tune = None ,
173
- model = None , random_seed = None ):
173
+ model = None , random_seed = - 1 ):
174
174
"""
175
175
Generator that returns a trace on each iteration using the given
176
176
step method. Multiple step methods supported via compound step
@@ -215,10 +215,11 @@ def iter_sample(draws, step, start=None, trace=None, chain=0, tune=None,
215
215
216
216
217
217
def _iter_sample (draws , step , start = None , trace = None , chain = 0 , tune = None ,
218
- model = None , random_seed = None ):
218
+ model = None , random_seed = - 1 ):
219
219
model = modelcontext (model )
220
220
draws = int (draws )
221
- seed (random_seed )
221
+ if random_seed != - 1 :
222
+ seed (random_seed )
222
223
if draws < 1 :
223
224
raise ValueError ('Argument `draws` should be above 0.' )
224
225
0 commit comments