compute_prox
Estimate proximals from function value sampling via HJ-Prox Algorithm.
The output estimates the proximal:
where \(\mathsf{x}\) = x
is the input, \(\mathsf{t}\)=t
is the time parameter,
and \(\mathsf{f}\)=f
is the function of interest. The process for this is
as follows.
- Sample points \(\mathsf{y^i}\) (via a Gaussian) about the input \(\mathsf{x}\)
- Evaluate function \(\mathsf{f}\) at each point \(\mathsf{y^i}\)
- Estimate proximal by using softmax to combine the values for \(\mathsf{f(y^i)}\) and \(\mathsf{y^i}\)
Note
The computation for the proximal involves the exponential of a potentially large negative number, which can result in underflow in floating point arithmetic that renders a grossly inaccurate proximal calculation. To avoid this, the "large negative number" is reduced in size by using a smaller value of alpha, returning a result once the underflow is not considered significant (as defined by the tolerances "tol" and "tol_underflow"). Utilizing a scaling trick with proximals, this is mitigated by using recursive function calls.
Warning
Memory errors can occur if too many layers of recursion are used, which can happen with tiny delta and large f(x).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
tensor
|
Input vector |
required |
t |
tensor
|
Time > 0 |
required |
f |
Callable
|
Function to minimize |
required |
delta |
float
|
Smoothing parameter |
0.1
|
int_samples |
int
|
Number of samples in Monte Carlo sampling for integral |
100
|
alpha |
float
|
Scaling parameter for sampling variance |
1.0
|
linesearch_iters |
int
|
Number of steps used in recursion (used for numerical stability) |
0
|
device |
string
|
Device on which to store variables |
'cpu'
|
Shape
- Input
x
is of size(n, 1)
wheren
is the dimension of the space of interest - The output
prox_term
also has size(n, 1)
Returns:
Name | Type | Description |
---|---|---|
prox_term |
tensor
|
Estimate of the proximal of f at x |
linesearch_iters |
int
|
Number of steps used in recursion (used for numerical stability) |
envelope |
tensor
|
Value of envelope function (i.e. infimal convolution) at proximal |
Example
Below is an exmaple for estimating the proximal of the L1 norm. Note the function
must have inputs of size (n_samples, n)
.