You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: cuqi/experimental/mcmc/_cwmh.py
+3-6Lines changed: 3 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -31,12 +31,9 @@ class CWMH(ProposalBasedSampler):
31
31
initial_point : ndarray
32
32
Initial parameters. *Optional*
33
33
34
-
callback : callable, *Optional*
35
-
If set this function will be called after every sample.
36
-
The signature of the callback function is
37
-
`callback(sample, sample_index)`, where `sample` is the current sample
38
-
and `sample_index` is the index of the sample.
39
-
An example is shown in demos/demo31_callback.py.
34
+
callback : callable, optional
35
+
A function that will be called after each sampling step. It can be useful for monitoring the sampler during sampling.
36
+
The function should take three arguments: the sampler object, the index of the current sampling step, the total number of requested samples. The last two arguments are integers. An example of the callback function signature is: `callback(sampler, sample_index, num_of_samples)`.
40
37
41
38
kwargs : dict
42
39
Additional keyword arguments to be passed to the base class
Copy file name to clipboardExpand all lines: cuqi/experimental/mcmc/_gibbs.py
+20-3Lines changed: 20 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -58,6 +58,10 @@ class HybridGibbs:
58
58
will call its step method in each Gibbs step.
59
59
Default is 1 for all variables.
60
60
61
+
callback : callable, optional
62
+
A function that will be called after each sampling step. It can be useful for monitoring the sampler during sampling.
63
+
The function should take three arguments: the sampler object, the index of the current sampling step, the total number of requested samples. The last two arguments are integers. An example of the callback function signature is: `callback(sampler, sample_index, num_of_samples)`.
Copy file name to clipboardExpand all lines: cuqi/experimental/mcmc/_hmc.py
+3-7Lines changed: 3 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -38,13 +38,9 @@ class NUTS(Sampler):
38
38
opt_acc_rate should be in (0, 1), however, choosing a value that is very
39
39
close to 1 or 0 might lead to poor performance of the sampler.
40
40
41
-
callback : callable, *Optional*
42
-
If set this function will be called after every sample.
43
-
The signature of the callback function is
44
-
`callback(sample, sample_index)`,
45
-
where `sample` is the current sample and `sample_index` is the index of
46
-
the sample.
47
-
An example is shown in demos/demo31_callback.py.
41
+
callback : callable, optional
42
+
A function that will be called after each sampling step. It can be useful for monitoring the sampler during sampling.
43
+
The function should take three arguments: the sampler object, the index of the current sampling step, the total number of requested samples. The last two arguments are integers. An example of the callback function signature is: `callback(sampler, sample_index, num_of_samples)`.
Copy file name to clipboardExpand all lines: cuqi/experimental/mcmc/_langevin_algorithm.py
+12-22Lines changed: 12 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -32,11 +32,9 @@ class ULA(Sampler): # Refactor to Proposal-based sampler?
32
32
be smaller than 1/L, where L is the Lipschitz of the gradient of the log
33
33
target density, logd).
34
34
35
-
callback : callable, *Optional*
36
-
If set this function will be called after every sample.
37
-
The signature of the callback function is `callback(sample, sample_index)`,
38
-
where `sample` is the current sample and `sample_index` is the index of the sample.
39
-
An example is shown in demos/demo31_callback.py.
35
+
callback : callable, optional
36
+
A function that will be called after each sampling step. It can be useful for monitoring the sampler during sampling.
37
+
The function should take three arguments: the sampler object, the index of the current sampling step, the total number of requested samples. The last two arguments are integers. An example of the callback function signature is: `callback(sampler, sample_index, num_of_samples)`.
40
38
41
39
42
40
Example
@@ -164,11 +162,9 @@ class MALA(ULA): # Refactor to Proposal-based sampler?
164
162
be smaller than 1/L, where L is the Lipschitz of the gradient of the log
165
163
target density, logd).
166
164
167
-
callback : callable, *Optional*
168
-
If set this function will be called after every sample.
169
-
The signature of the callback function is `callback(sample, sample_index)`,
170
-
where `sample` is the current sample and `sample_index` is the index of the sample.
171
-
An example is shown in demos/demo31_callback.py.
165
+
callback : callable, optional
166
+
A function that will be called after each sampling step. It can be useful for monitoring the sampler during sampling.
167
+
The function should take three arguments: the sampler object, the index of the current sampling step, the total number of requested samples. The last two arguments are integers. An example of the callback function signature is: `callback(sampler, sample_index, num_of_samples)`.
172
168
173
169
174
170
Example
@@ -288,12 +284,9 @@ class MYULA(ULA):
288
284
smoothing_strength : float
289
285
This parameter controls the smoothing strength of MYULA.
290
286
291
-
callback : callable, *Optional*
292
-
If set this function will be called after every sample.
293
-
The signature of the callback function is `callback(sample, sample_index)`,
294
-
where `sample` is the current sample and `sample_index` is the index of
295
-
the sample.
296
-
An example is shown in demos/demo31_callback.py.
287
+
callback : callable, optional
288
+
A function that will be called after each sampling step. It can be useful for monitoring the sampler during sampling.
289
+
The function should take three arguments: the sampler object, the index of the current sampling step, the total number of requested samples. The last two arguments are integers. An example of the callback function signature is: `callback(sampler, sample_index, num_of_samples)`.
297
290
298
291
A Deblur example can be found in demos/howtos/myula.py
299
292
# TODO: update demo once sampler merged
@@ -378,12 +371,9 @@ class PnPULA(MYULA):
378
371
This parameter controls the smoothing strength of PnP-ULA.
379
372
380
373
381
-
callback : callable, *Optional*
382
-
If set this function will be called after every sample.
383
-
The signature of the callback function is `callback(sample, sample_index)`,
384
-
where `sample` is the current sample and `sample_index` is the index of
385
-
the sample.
386
-
An example is shown in demos/demo31_callback.py.
374
+
callback : callable, optional
375
+
A function that will be called after each sampling step. It can be useful for monitoring the sampler during sampling.
376
+
The function should take three arguments: the sampler object, the index of the current sampling step, the total number of requested samples. The last two arguments are integers. An example of the callback function signature is: `callback(sampler, sample_index, num_of_samples)`.
Copy file name to clipboardExpand all lines: cuqi/experimental/mcmc/_laplace_approximation.py
+3-5Lines changed: 3 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -43,11 +43,9 @@ class UGLA(Sampler):
43
43
sampling easier but results in a worse approximation. See details in Section 3.3 of the paper.
44
44
If not provided, it defaults to 1e-5.
45
45
46
-
callback : callable, *Optional*
47
-
If set, this function will be called after every sample.
48
-
The signature of the callback function is `callback(sample, sample_index)`,
49
-
where `sample` is the current sample and `sample_index` is the index of the sample.
50
-
An example is shown in demos/demo31_callback.py.
46
+
callback : callable, optional
47
+
A function that will be called after each sampling step. It can be useful for monitoring the sampler during sampling.
48
+
The function should take three arguments: the sampler object, the index of the current sampling step, the total number of requested samples. The last two arguments are integers. An example of the callback function signature is: `callback(sampler, sample_index, num_of_samples)`.
Copy file name to clipboardExpand all lines: cuqi/experimental/mcmc/_rto.py
+6-10Lines changed: 6 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -36,11 +36,9 @@ class LinearRTO(Sampler):
36
36
tol : float
37
37
Tolerance of the inner CGLS solver. *Optional*.
38
38
39
-
callback : callable, *Optional*
40
-
If set this function will be called after every sample.
41
-
The signature of the callback function is `callback(sample, sample_index)`,
42
-
where `sample` is the current sample and `sample_index` is the index of the sample.
43
-
An example is shown in demos/demo31_callback.py.
39
+
callback : callable, optional
40
+
A function that will be called after each sampling step. It can be useful for monitoring the sampler during sampling.
41
+
The function should take three arguments: the sampler object, the index of the current sampling step, the total number of requested samples. The last two arguments are integers. An example of the callback function signature is: `callback(sampler, sample_index, num_of_samples)`.
@@ -204,11 +202,9 @@ class RegularizedLinearRTO(LinearRTO):
204
202
solver : string
205
203
If set to "ScipyLinearLSQ", solver is set to cuqi.solver.ScipyLinearLSQ, otherwise FISTA/ISTA or ADMM is used. Note "ScipyLinearLSQ" can only be used with `RegularizedGaussian` of `box` or `nonnegativity` constraint. *Optional*.
206
204
207
-
callback : callable, *Optional*
208
-
If set this function will be called after every sample.
209
-
The signature of the callback function is `callback(sample, sample_index)`,
210
-
where `sample` is the current sample and `sample_index` is the index of the sample.
211
-
An example is shown in demos/demo31_callback.py.
205
+
callback : callable, optional
206
+
A function that will be called after each sampling step. It can be useful for monitoring the sampler during sampling.
207
+
The function should take three arguments: the sampler object, the index of the current sampling step, the total number of requested samples. The last two arguments are integers. An example of the callback function signature is: `callback(sampler, sample_index, num_of_samples)`.
The initial point for the sampler. If not given, the sampler will choose an initial point.
60
60
61
61
callback : callable, optional
62
-
A function that will be called after each sample is drawn. The function should take two arguments: the sample and the index of the sample.
63
-
The sample is a 1D numpy array and the index is an integer. The callback function is useful for monitoring the sampler during sampling.
64
-
62
+
A function that will be called after each sampling step. It can be useful for monitoring the sampler during sampling.
63
+
The function should take three arguments: the sampler object, the index of the current sampling step, the total number of requested samples. The last two arguments are integers. An example of the callback function signature is: `callback(sampler, sample_index, num_of_samples)`.
The signature of the callback function is `callback(sample, sample_index)`,
305
305
where `sample` is the current sample and `sample_index` is the index of the sample.
306
306
An example is shown in demos/demo31_callback.py.
307
+
Note: if the parameter `experimental` is set to True, the callback function should take three arguments: the sampler object, the index of the current sampling step, the total number of requested samples. The last two arguments are integers. An example of the callback function signature in the case is: `callback(sampler, sample_index, num_of_samples)`.
307
308
308
309
experimental : bool, *Optional*
309
310
If set to True, the sampler selection will use the samplers from the :mod:`cuqi.experimental.mcmc` module.
0 commit comments