Skip to content

Commit 4d9be9b

Browse files
committed
minor: docstring improvements
1 parent 2fc6eca commit 4d9be9b

3 files changed

Lines changed: 27 additions & 14 deletions

File tree

pyproximal/optimization/pnp.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,19 @@ def PlugAndPlay(
5353
) -> NDArray | tuple[NDArray, ...]:
5454
r"""Plug-and-Play Priors with any proximal algorithm of choice
5555
56-
Solves the following minimization problem using any proximal a
57-
lgorithm of choice:
56+
Solves the following minimization problem using any proximal
57+
algorithm of choice:
5858
5959
.. math::
6060
61-
\mathbf{x},\mathbf{z} = \argmin_{\mathbf{x}}
62-
f(\mathbf{x}) + \lambda g(\mathbf{x})
61+
\mathbf{x} = \argmin_{\mathbf{x}}
62+
f(\mathbf{x}) + \sigma g(\mathbf{x})
6363
6464
where :math:`f(\mathbf{x})` is a function that has a known gradient or
65-
proximal operator and :math:`g(\mathbf{x})` is a function acting as implicit
66-
prior. Implicit means that no explicit function should be defined: instead,
67-
a denoising algorithm of choice is used. See Notes for details.
65+
proximal operator and :math:`g(\mathbf{x})` is a function acting as an
66+
implicit prior. Implicit means that no explicit function should be
67+
defined: instead, a denoising algorithm of choice is used. See Notes
68+
for details.
6869
6970
Parameters
7071
----------
@@ -97,25 +98,28 @@ def PlugAndPlay(
9798
.. math::
9899
99100
\mathbf{x}^{k+1} = \prox_{\tau f}(\mathbf{z}^{k} - \mathbf{u}^{k})\\
100-
\mathbf{z}^{k+1} = \operatorname{Denoise}(\mathbf{x}^{k+1} + \mathbf{u}^{k}, \tau \lambda)\\
101+
\mathbf{z}^{k+1} = \operatorname{Denoise}(\mathbf{x}^{k+1} + \mathbf{u}^{k}, \tau \sigma)\\
101102
\mathbf{u}^{k+1} = \mathbf{u}^{k} + \mathbf{x}^{k+1} - \mathbf{z}^{k+1}
102103
103104
where :math:`\operatorname{Denoise}` is a denoising algorithm of choice. This rather peculiar step originates
104105
from the intuition that the optimization process associated with the z-update can be interpreted as a denoising
105106
inverse problem, or more specifically a MAP denoiser where the noise is gaussian with zero mean and variance
106-
equal to :math:`\tau \lambda`. For this reason any denoising of choice can be used instead of a function with
107+
equal to :math:`\tau \sigma`. For this reason any denoising of choice can be used instead of a function with
107108
known proximal operator.
108109
109-
Finally, whilst the :math:`\tau \lambda` denoising parameter should be chosen to
110+
Finally, whilst the :math:`\tau \sigma` denoising parameter should be chosen to
110111
represent an estimate of the noise variance (of the denoiser, not the data of the problem we wish to solve!),
111112
special care must be taken when setting up the denoiser and calling this optimizer. More specifically,
112-
:math:`\lambda` should not be passed to the optimizer, rather set directly in the denoiser.
113+
:math:`\sigma` should not be passed to the optimizer, rather set directly in the denoiser.
113114
On the other hand :math:`\tau` must be passed to the optimizer as it is also affecting the x-update;
114-
when defining the denoiser, ensure that :math:`\tau` is multiplied to :math:`\lambda` as shown in the tutorial.
115+
when defining the denoiser, ensure that :math:`\tau` is multiplied to :math:`\sigma` as shown in the tutorial.
115116
116-
Alternative, as suggested in [2]_, the :math:`\tau` could be set to 1. The parameter :math:`\lambda` can then be set
117+
Alternative, as suggested in [2]_, the :math:`\tau` could be set to 1. The parameter :math:`\sigma` can then be set
117118
to maximize the value of the denoiser and a second tuning parameter can be added directly to :math:`f`.
118119
120+
References
121+
----------
122+
119123
.. [1] Venkatakrishnan, S. V., Bouman, C. A. and Wohlberg, B.
120124
"Plug-and-Play priors for model based reconstruction",
121125
IEEE. 2013.

pyproximal/optimization/segmentation.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ def Segment(
8282
:math:`\mathbf{\sigma}=[\sigma_1, ..., \sigma_{N_{cl}}]^T` are vectors
8383
representing the optimal mean and standard deviations for each class.
8484
85+
References
86+
----------
87+
8588
.. [1] Chambolle, and A., Pock, "A first-order primal-dual algorithm for
8689
convex problems with applications to imaging", Journal of Mathematical
8790
Imaging and Vision, 40, 8pp. 120–145. 2011.

pyproximal/optimization/sr3.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def SR3(
152152
153153
Notes
154154
-----
155-
SR3 uses the following algorithm:
155+
SR3 uses the following algorithm [1]_:
156156
157157
.. math::
158158
\mathbf{x}_{k+1} = (\mathbf{A}^T\mathbf{A} + \kappa
@@ -161,6 +161,12 @@ def SR3(
161161
\mathbf{y}_{k+1} = \prox_{\lambda/\kappa\mathcal{R}}
162162
(\mathbf{Lx}_{k+1})
163163
164+
References
165+
----------
166+
.. [1] Zheng, P., Askham, T., Brunton, S. L., Kutz, N.,
167+
and Aravkin, A. Y. "A Unified Framework for Sparse Relaxed
168+
Regularized Regression: SR3", https://arxiv.org/abs/1807.05411.
169+
164170
"""
165171
(m, n) = Op.shape
166172
if x0 is None:

0 commit comments

Comments
 (0)