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 — TypeL1RegularizationRegularization term implementing the proximal map for the Lasso problem.
RegularizedLeastSquares.L2Regularization — TypeL2RegularizationRegularization term implementing the proximal map for Tikhonov regularization.
RegularizedLeastSquares.L21Regularization — TypeL21RegularizationRegularization term implementing the proximal map for group-soft-thresholding.
Arguments
- λ- regularization paramter
Keywords
- slices=1- number of elements per group
RegularizedLeastSquares.LLRRegularization — TypeLLRRegularizationRegularization 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 image
- blockSize::Tuple{Int}=(2,2)- size of patches to perform singular value thresholding on
- randshift::Bool=true- randomly shifts the patches to ensure translation invariance
- fullyOverlapping::Bool=false- choose between fully overlapping block or non-overlapping blocks
RegularizedLeastSquares.NuclearRegularization — TypeNuclearRegularizationRegularization term implementing the proximal map for singular value soft-thresholding.
Arguments:
- λ- regularization paramter
Keywords
- svtShape::NTuple- size of the underlying matrix
RegularizedLeastSquares.TVRegularization — TypeTVRegularizationRegularization 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 image
- dims- Dimension to perform the TV along. If- Integer, the Condat algorithm is called, and the FDG algorithm otherwise.
- iterationsTV=20- number of FGP iterations
Projection Regularization
RegularizedLeastSquares.PositiveRegularization — TypePositiveRegularizationRegularization term implementing a projection onto positive and real numbers.
RegularizedLeastSquares.RealRegularization — TypeRealRegularizationRegularization 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 — TypeAbstractScaledRegularizationNested 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 — TypeNormalizedRegularizationNested 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 — TypeNoNormalizationNo 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 — TypeFixedParameterRegularizationNested 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 — TypeMaskedRegularizationNested 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.0RegularizedLeastSquares.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 domainRegularizedLeastSquares.PlugAndPlayRegularization — Type    PlugAndPlayRegularizationRegularization 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 image
- shape- dimensions of the image
- input_transform- transform of image before- model
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