proxtorch.operators#
- class proxtorch.operators.Dummy[source]#
Bases:
ProxOperatorDummy proximal operator that acts as an identity operation.
This class provides methods for soft-thresholding consistent with L1 norm and computation of the L1 norm.
- class proxtorch.operators.ElasticNet(alpha: float = 1.0, l1_ratio: float = 0.5)[source]#
Bases:
ProxOperatorElastic Net proximal operator.
Combines both L1 and L2 penalties for regularization.
- class proxtorch.operators.Frobenius(alpha: float = 1.0)[source]#
Bases:
ProxOperatorProximal operator for the Frobenius norm regularization.
- class proxtorch.operators.FusedLasso(alpha: float)[source]#
Bases:
ProxOperatorProximal operator for the 1D Fused Lasso.
- prox(x: Tensor, tau: float) Tensor[source]#
Apply the proximal operation for the 1D fused lasso. Uses a simple soft-thresholding approach.
- Parameters:
x (Tensor) – Input tensor.
tau (float) – Proximal step size.
- Returns:
Result after applying the fused lasso operation.
- Return type:
Tensor
Note
More efficient algorithms exist for larger-scale problems.
- class proxtorch.operators.GraphNet2D(alpha, l1_ratio)[source]#
Bases:
GraphNet3D,TVL1_2D- divergence(p: Tensor) Tensor#
Compute the divergence of the tensor p.
- Parameters:
p (torch.Tensor) – Input tensor.
- Returns:
Divergence of the tensor p.
- Return type:
- gradient(x)#
Compute the gradient of the tensor x using finite differences.
- Parameters:
x (torch.Tensor) – Input tensor.
- Returns:
Gradients of the tensor x.
- Return type:
- prox(x: Tensor, tau: float) Tensor#
Iterative algorithm to compute the proximal mapping of the tensor.
- Parameters:
x (torch.Tensor) – Input tensor.
lr (float) – Learning rate.
- Returns:
Tensor after applying the proximal operation.
- Return type:
Notes
Total variation denoising aims to minimize the total variation of the image, which can be roughly described as the integral of the norm of the image gradient. As a result, it produces “cartoon-like” images, i.e., piecewise-constant images. For more details, refer to: http://en.wikipedia.org/wiki/Total_variation_denoising
This function implements the FISTA (Fast Iterative Shrinkage Thresholding Algorithm) algorithm of Beck et Teboulle, adapted to total variation denoising in “Fast gradient-based algorithms for constrained total variation image denoising and deblurring problems” (2009).
For more on bound constraints implementation, see the aforementioned Beck and Teboulle paper.
- static tvl1_from_grad(gradients: Tensor) Tensor#
Calculate the TV from gradients.
- Parameters:
gradients (torch.Tensor) – Gradient tensor.
- Returns:
The TV value computed from the gradients.
- Return type:
- class proxtorch.operators.GraphNet3D(alpha, l1_ratio)[source]#
Bases:
TVL1_3D- divergence(p: Tensor) Tensor#
Compute the divergence of the tensor p.
- Parameters:
p (torch.Tensor) – Input tensor.
- Returns:
Divergence of the tensor p.
- Return type:
- gradient(x)#
Compute the gradient of the tensor x using finite differences.
- Parameters:
x (torch.Tensor) – Input tensor.
- Returns:
Gradients of the tensor x.
- Return type:
- prox(x: Tensor, tau: float) Tensor[source]#
Iterative algorithm to compute the proximal mapping of the tensor.
- Parameters:
x (torch.Tensor) – Input tensor.
lr (float) – Learning rate.
- Returns:
Tensor after applying the proximal operation.
- Return type:
Notes
Total variation denoising aims to minimize the total variation of the image, which can be roughly described as the integral of the norm of the image gradient. As a result, it produces “cartoon-like” images, i.e., piecewise-constant images. For more details, refer to: http://en.wikipedia.org/wiki/Total_variation_denoising
This function implements the FISTA (Fast Iterative Shrinkage Thresholding Algorithm) algorithm of Beck et Teboulle, adapted to total variation denoising in “Fast gradient-based algorithms for constrained total variation image denoising and deblurring problems” (2009).
For more on bound constraints implementation, see the aforementioned Beck and Teboulle paper.
- static tvl1_from_grad(gradients: Tensor) Tensor#
Calculate the TV from gradients.
- Parameters:
gradients (torch.Tensor) – Gradient tensor.
- Returns:
The TV value computed from the gradients.
- Return type:
- class proxtorch.operators.GroupLasso(alpha: float, group_sizes: list)[source]#
Bases:
ProxOperator
- class proxtorch.operators.Huber(alpha: float = 1.0, delta: float = 1.0)[source]#
Bases:
ProxOperatorProximal operator for the Huber penalty.
- class proxtorch.operators.L1(alpha: float = 1.0)[source]#
Bases:
ProxOperatorL1 norm proximal operator.
The L1 norm promotes sparsity in the tensor.
- class proxtorch.operators.L2(alpha: float = 1.0)[source]#
Bases:
ProxOperatorL2 norm proximal operator.
This class provides methods for soft-thresholding and computation of the L2 norm.
- class proxtorch.operators.TVL1_2D(alpha: float, l1_ratio=0.05, max_iter: int = 200, tol: float = 5e-05)[source]#
Bases:
TVL1_3D- divergence(p: Tensor) Tensor[source]#
Compute the divergence of the tensor p.
- Parameters:
p (torch.Tensor) – Input tensor.
- Returns:
Divergence of the tensor p.
- Return type:
- gradient(x)#
Compute the gradient of the tensor x using finite differences.
- Parameters:
x (torch.Tensor) – Input tensor.
- Returns:
Gradients of the tensor x.
- Return type:
- prox(x: Tensor, lr: float) Tensor#
Iterative algorithm to compute the proximal mapping of the tensor.
- Parameters:
x (torch.Tensor) – Input tensor.
lr (float) – Learning rate.
- Returns:
Tensor after applying the proximal operation.
- Return type:
Notes
Total variation denoising aims to minimize the total variation of the image, which can be roughly described as the integral of the norm of the image gradient. As a result, it produces “cartoon-like” images, i.e., piecewise-constant images. For more details, refer to: http://en.wikipedia.org/wiki/Total_variation_denoising
This function implements the FISTA (Fast Iterative Shrinkage Thresholding Algorithm) algorithm of Beck et Teboulle, adapted to total variation denoising in “Fast gradient-based algorithms for constrained total variation image denoising and deblurring problems” (2009).
For more on bound constraints implementation, see the aforementioned Beck and Teboulle paper.
- static tvl1_from_grad(gradients: Tensor) Tensor#
Calculate the TV from gradients.
- Parameters:
gradients (torch.Tensor) – Gradient tensor.
- Returns:
The TV value computed from the gradients.
- Return type:
- class proxtorch.operators.TVL1_3D(alpha: float, l1_ratio=0.05, max_iter: int = 200, tol: float = 5e-05)[source]#
Bases:
ProxOperatorClass for the 3D Total Variation proximal operator.
- divergence(p: Tensor) Tensor[source]#
Compute the divergence of the tensor p.
- Parameters:
p (torch.Tensor) – Input tensor.
- Returns:
Divergence of the tensor p.
- Return type:
- gradient(x)[source]#
Compute the gradient of the tensor x using finite differences.
- Parameters:
x (torch.Tensor) – Input tensor.
- Returns:
Gradients of the tensor x.
- Return type:
- prox(x: Tensor, lr: float) Tensor[source]#
Iterative algorithm to compute the proximal mapping of the tensor.
- Parameters:
x (torch.Tensor) – Input tensor.
lr (float) – Learning rate.
- Returns:
Tensor after applying the proximal operation.
- Return type:
Notes
Total variation denoising aims to minimize the total variation of the image, which can be roughly described as the integral of the norm of the image gradient. As a result, it produces “cartoon-like” images, i.e., piecewise-constant images. For more details, refer to: http://en.wikipedia.org/wiki/Total_variation_denoising
This function implements the FISTA (Fast Iterative Shrinkage Thresholding Algorithm) algorithm of Beck et Teboulle, adapted to total variation denoising in “Fast gradient-based algorithms for constrained total variation image denoising and deblurring problems” (2009).
For more on bound constraints implementation, see the aforementioned Beck and Teboulle paper.
- class proxtorch.operators.TV_2D(alpha: float, max_iter: int = 200, tol: float = 0.0001)[source]#
Bases:
TVL1_2D- divergence(p: Tensor) Tensor#
Compute the divergence of the tensor p.
- Parameters:
p (torch.Tensor) – Input tensor.
- Returns:
Divergence of the tensor p.
- Return type:
- gradient(x)#
Compute the gradient of the tensor x using finite differences.
- Parameters:
x (torch.Tensor) – Input tensor.
- Returns:
Gradients of the tensor x.
- Return type:
- prox(x: Tensor, lr: float) Tensor#
Iterative algorithm to compute the proximal mapping of the tensor.
- Parameters:
x (torch.Tensor) – Input tensor.
lr (float) – Learning rate.
- Returns:
Tensor after applying the proximal operation.
- Return type:
Notes
Total variation denoising aims to minimize the total variation of the image, which can be roughly described as the integral of the norm of the image gradient. As a result, it produces “cartoon-like” images, i.e., piecewise-constant images. For more details, refer to: http://en.wikipedia.org/wiki/Total_variation_denoising
This function implements the FISTA (Fast Iterative Shrinkage Thresholding Algorithm) algorithm of Beck et Teboulle, adapted to total variation denoising in “Fast gradient-based algorithms for constrained total variation image denoising and deblurring problems” (2009).
For more on bound constraints implementation, see the aforementioned Beck and Teboulle paper.
- static tvl1_from_grad(gradients: Tensor) Tensor#
Calculate the TV from gradients.
- Parameters:
gradients (torch.Tensor) – Gradient tensor.
- Returns:
The TV value computed from the gradients.
- Return type:
- class proxtorch.operators.TV_3D(alpha: float, max_iter: int = 200, tol: float = 0.0001)[source]#
Bases:
TVL1_3D- divergence(p: Tensor) Tensor#
Compute the divergence of the tensor p.
- Parameters:
p (torch.Tensor) – Input tensor.
- Returns:
Divergence of the tensor p.
- Return type:
- gradient(x)#
Compute the gradient of the tensor x using finite differences.
- Parameters:
x (torch.Tensor) – Input tensor.
- Returns:
Gradients of the tensor x.
- Return type:
- prox(x: Tensor, lr: float) Tensor#
Iterative algorithm to compute the proximal mapping of the tensor.
- Parameters:
x (torch.Tensor) – Input tensor.
lr (float) – Learning rate.
- Returns:
Tensor after applying the proximal operation.
- Return type:
Notes
Total variation denoising aims to minimize the total variation of the image, which can be roughly described as the integral of the norm of the image gradient. As a result, it produces “cartoon-like” images, i.e., piecewise-constant images. For more details, refer to: http://en.wikipedia.org/wiki/Total_variation_denoising
This function implements the FISTA (Fast Iterative Shrinkage Thresholding Algorithm) algorithm of Beck et Teboulle, adapted to total variation denoising in “Fast gradient-based algorithms for constrained total variation image denoising and deblurring problems” (2009).
For more on bound constraints implementation, see the aforementioned Beck and Teboulle paper.
- static tvl1_from_grad(gradients: Tensor) Tensor#
Calculate the TV from gradients.
- Parameters:
gradients (torch.Tensor) – Gradient tensor.
- Returns:
The TV value computed from the gradients.
- Return type:
- class proxtorch.operators.TraceNorm(alpha: float = 1.0)[source]#
Bases:
ProxOperatorProximal operator for the trace norm regularization.