API for Regularizers
This page contains documentation of the public API of the RegularizedLeastSquares. In the Julia REPL one can access this documentation by entering the help mode with ?
RegularizedLeastSquares.L1Regularization
— TypeL1Regularization
Regularization term implementing the proximal map for the Lasso problem.
RegularizedLeastSquares.L2Regularization
— TypeL2Regularization
Regularization term implementing the proximal map for Tikhonov regularization.
RegularizedLeastSquares.L21Regularization
— TypeL21Regularization
Regularization term implementing the proximal map for group-soft-thresholding.
Arguments
λ
- regularization paramter
Keywords
slices=1
- number of elements per group
RegularizedLeastSquares.LLRRegularization
— TypeLLRRegularization
Regularization term implementing the proximal map for locally low rank (LLR) regularization using singular-value-thresholding.
Arguments
λ
- regularization paramter
Keywords
shape::Tuple{Int}=[]
- dimensions of the imageblockSize::Tuple{Int}=[2;2]
- size of patches to perform singular value thresholding onrandshift::Bool=true
- randomly shifts the patches to ensure translation invariance
RegularizedLeastSquares.NuclearRegularization
— TypeNuclearRegularization
Regularization term implementing the proximal map for singular value soft-thresholding.
Arguments:
λ
- regularization paramter
Keywords
svtShape::NTuple
- size of the underlying matrix
RegularizedLeastSquares.TVRegularization
— TypeTVRegularization
Regularization term implementing the proximal map for TV regularization. Calculated with the Condat algorithm if the TV is calculated only along one real-valued dimension and with the Fast Gradient Projection algorithm otherwise.
Reference for the Condat algorithm: https://lcondat.github.io/publis/Condat-fast_TV-SPL-2013.pdf
Reference for the FGP algorithm: A. Beck and T. Teboulle, "Fast Gradient-Based Algorithms for Constrained Total Variation Image Denoising and Deblurring Problems", IEEE Trans. Image Process. 18(11), 2009
Arguments
λ::T
- regularization parameter
Keywords
shape::NTuple
- size of the underlying imagedims
- Dimension to perform the TV along. IfInteger
, the Condat algorithm is called, and the FDG algorithm otherwise.iterationsTV=20
- number of FGP iterations
Projection Regularization
RegularizedLeastSquares.PositiveRegularization
— TypePositiveRegularization
Regularization term implementing a projection onto positive and real numbers.
RegularizedLeastSquares.RealRegularization
— TypeRealRegularization
Regularization term implementing a projection onto real numbers.
Nested Regularization
RegularizedLeastSquares.innerreg
— Methodinnerreg(reg::AbstractNestedRegularization)
return the inner
regularization term of reg
. Nested regularization terms also implement the iteration interface.
RegularizedLeastSquares.sink
— Methodsink(reg::AbstractNestedRegularization)
return the innermost regularization term.
RegularizedLeastSquares.sinktype
— Methodsinktype(reg::AbstractNestedRegularization)
return the type of the innermost regularization term.
See also sink
.
Scaled Regularization
RegularizedLeastSquares.AbstractScaledRegularization
— TypeAbstractScaledRegularization
Nested regularization term that applies a scalefactor
to the regularization parameter λ
of its inner
term.
See also scalefactor
, λ
, innerreg
.
RegularizedLeastSquares.scalefactor
— Functionscalescalefactor(reg::AbstractScaledRegularization)
return the scaling scalefactor
for λ
RegularizedLeastSquares.NormalizedRegularization
— TypeNormalizedRegularization
Nested regularization term that scales λ
according to normalization scheme. This term is commonly applied by a solver based on a given normalization keyword
#See also NoNormalization
, MeasurementBasedNormalization
, SystemMatrixBasedNormalization
.
RegularizedLeastSquares.NoNormalization
— TypeNoNormalization
No normalization to λ
is applied.
RegularizedLeastSquares.MeasurementBasedNormalization
— TypeMeasurementBasedNormalization
λ
is normalized by the 1-norm of b
divided by its length.
RegularizedLeastSquares.SystemMatrixBasedNormalization
— TypeSystemMatrixBasedNormalization
λ
is normalized by the energy of the system matrix rows.
RegularizedLeastSquares.FixedParameterRegularization
— TypeFixedParameterRegularization
Nested regularization term that discards any λ
passed to it and instead uses λ
from its inner regularization term. This can be used to selectively disallow normalization.
Misc. Nested Regularization
RegularizedLeastSquares.MaskedRegularization
— TypeMaskedRegularization
Nested regularization term that only applies prox!
and norm
to elements of x
for which the mask is true
.
Examples
julia> positive = PositiveRegularization();
+
+julia> masked = MaskedRegularization(reg, [true, false, true, false]);
+
+julia> prox!(masked, fill(-1, 4))
+4-element Vector{Float64}:
+ 0.0
+ -1.0
+ 0.0
+ -1.0
RegularizedLeastSquares.TransformedRegularization
— TypeTransformedRegularization(reg, trafo)
Nested regularization term that applies prox!
or norm
on z = trafo * x
and returns (inplace) x = adjoint(trafo) * z
.
Example
julia> core = L1Regularization(0.8)
+L1Regularization{Float64}(0.8)
+
+julia> wop = WaveletOp(Float32, shape = (32,32));
+
+julia> reg = TransformedRegularization(core, wop);
+
+julia> prox!(reg, randn(32*32)); # Apply soft-thresholding in Wavelet domain
RegularizedLeastSquares.PlugAndPlayRegularization
— Type PlugAndPlayRegularization
Regularization term implementing a given plug-and-play proximal mapping. The actual regularization term is indirectly defined by the learned proximal mapping and as such there is no norm
implemented.
Arguments
λ
- regularization paramter
Keywords
model
- model applied to the imageshape
- dimensions of the imageinput_transform
- transform of image beforemodel
Miscellaneous Functions
RegularizedLeastSquares.prox!
— Methodprox!(reg::AbstractParameterizedRegularization, x)
perform the proximal mapping defined by reg
on x
. Uses the regularization parameter defined for reg
.
RegularizedLeastSquares.prox!
— Methodprox!(regType::Type{<:AbstractParameterizedRegularization}, x, λ; kwargs...)
construct a regularization term of type regType
with given λ
and kwargs
and apply its prox!
on x
LinearAlgebra.norm
— Methodnorm(reg::AbstractParameterizedRegularization, x)
returns the value of the reg
regularization term on x
. Uses the regularization parameter defined for reg
.
RegularizedLeastSquares.λ
— Methodλ(reg::AbstractParameterizedRegularization)
return the regularization parameter λ
of reg
LinearAlgebra.norm
— Methodnorm(regType::Type{<:AbstractParameterizedRegularization}, x, λ; kwargs...)
construct a regularization term of type regType
with given λ
and kwargs
and apply its norm
on x