-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shifted Composite L1 Norm #123
Shifted Composite L1 Norm #123
Conversation
new file: src/CompositeNormL1.jl new file: src/ShiftedCompositeNormL1.jl modified: src/ShiftedProximalOperators.jl modified: test/runtests.jl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think things would be clearer if you defined a type
abstract AbstractCompositeNorm <: CompositeProximableFunction end
and then
CompositeNormL1 <: AbstractCompositeNorm
CompositeNormL2 <: AbstractCompositeNorm
Co-authored-by: Dominique <dominique.orban@gmail.com>
Co-authored-by: Dominique <dominique.orban@gmail.com>
Co-authored-by: Dominique <dominique.orban@gmail.com>
Co-authored-by: Dominique <dominique.orban@gmail.com>
Co-authored-by: Dominique <dominique.orban@gmail.com>
Co-authored-by: Dominique <dominique.orban@gmail.com>
should no longer need a NormL1 struct to be constructed.
Co-authored-by: Dominique <dominique.orban@gmail.com>
Co-authored-by: Dominique <dominique.orban@gmail.com>
Co-authored-by: Dominique <dominique.orban@gmail.com>
&J(x) : \mathbb{R}^n \xrightarrow[]{} \mathbb{R}^{m\times n} | ||
\end{aligned} | ||
``` | ||
such that J is the Jacobian of c. A and b should respectively be a matrix and a vector which can respectively store the values of J and c. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be useful to state how c!()
and J!()
are expected to be called and what they should return. In particular, is A
expected to be dense or sparse? In NLPModels, there is no Jacobian method that fills in a matrix, i.e., something like jac!(nlp, x, A)
does not exist. However, there is jac_coord!(nlp, x, vals)
, which fills in the array vals
of nonzeros elements in the sparse coordinate representation of the Jacobian.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a commit, see MaxenceGollier:affineNormL1@561c415
I just changed the documentation, do you expect to force A by changing the type in the constructor ? I don't know if it is necessary.
@@ -0,0 +1,85 @@ | |||
export ShiftedCompositeNormL1 | |||
|
|||
mutable struct ShiftedCompositeNormL1{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs some documentation to explain that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See MaxenceGollier:affineNormL1@bb3faaa
end | ||
|
||
function (ψ::CompositeProximableFunction)(y) | ||
z = similar(ψ.b) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preallocate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I add z as an argument, there will be problems later with R2 and overall most solvers compute
ψ = CompositeOp(λ,c!,J!,A,b) | ||
|
||
# test non shifted operator | ||
@test ψ(ones(Float64,4)) == h([1,2]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In our implementation,
Co-authored-by: Dominique <dominique.orban@gmail.com>
Co-authored-by: Dominique <dominique.orban@gmail.com>
Co-authored-by: Dominique <dominique.orban@gmail.com>
Co-authored-by: Dominique <dominique.orban@gmail.com>
Co-authored-by: Dominique <dominique.orban@gmail.com>
Co-authored-by: Dominique <dominique.orban@gmail.com>
Implementation of the proximal operator of a composite term$||Ax+b||_1$ . This is different from other operators of this library in the fact that shifts are no longer simply $\psi(x+s)$ for some non-differentiable function $\psi$ .
Hence, some abstract types are added in ShiftedProximalOperators.jl.
In practice, such proximal operators are useful when we want to make a model of a penalty term$x \xrightarrow{} ||c(x)||_1$ . The first-order model of the penalty term is then $s \xrightarrow{} ||c(x) + J(x)s||_1$ .
As mentionned above, the shift is no longer simply$\psi(x+s)$ . Hence, we add a CompositeNormL1 struct which mimics the unshifted function and implements $x\xrightarrow{} ||c(x)||_1$ . On shifts, this transforms to a ShiftedCompositeNormL1 struct which implements $s\xrightarrow{} ||c(x)+J(x)s||_1$ .