Skip to content
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

Add flag to hide warnings #25

Closed
nantonel opened this issue Aug 8, 2019 · 8 comments
Closed

Add flag to hide warnings #25

nantonel opened this issue Aug 8, 2019 · 8 comments

Comments

@nantonel
Copy link
Collaborator

nantonel commented Aug 8, 2019

Should be easy to implement?

For example in PANOC

if warnings
  @warn "parameter `gamma` became too small ($(state.gamma)), stopping the iterations"
end

I would also default it to warnings=false.

@lostella
Copy link
Member

I agree in principle, but could you attach a MWE that triggers the warning? Because while hiding the warning we should also (i) make sure that no bug is causing the line search to fail (ii) if no bug is there, make the algorithm's stopping criterion more robust (or line search one, or both).

@nantonel
Copy link
Collaborator Author

Stumbled upon this MWE

using StructuredOptimization
using Random
using ProximalAlgorithms: PANOC 
using ProximalOperators, AbstractOperators
using RecursiveArrayTools

Random.seed!(13)
n,m = 10,20
Y = randn(n,m)

A = [Eye(size(Y)) Eye(size(Y))]
x0 = ArrayPartition(zeros(size(Y)), zeros(size(Y)))

f = PrecomposeDiagonal(SqrNormL2(), 1.0, Y)
g1 = NormL1() 
g2 = IndBallRank(2) 
g = SeparableSum(g2,g1) 

solver = PANOC(verbose=true)
solver(x0; f=f, A=A, g=g)

maybe there's something simpler but better then nothing for the moment!

@lostella
Copy link
Member

On Julia 1.1.1 I get an even stranger behaviour:

[...]
  120 | 4.750e-01 | 8.124e-08 | 1.000e+00
  130 | 4.750e-01 | 1.877e-07 | 5.000e-01
┌ Warning: stepsize `tau` became too small (0.0009765625), stopping the iterations
└ @ ProximalAlgorithms ~/.julia/dev/ProximalAlgorithms/src/algorithms/panoc.jl:182
  139 | 4.750e-01 | 7.043e-07 | 7.813e-03
  149 | 4.750e-01 | 1.803e-07 | 5.000e-01
[...]

i.e., the warning is actually a lie! (The iteration continues somehow) Looking into it.

@nantonel
Copy link
Collaborator Author

Yes, I forgot to mention that I'm in Julia 1.1.1!

@lostella
Copy link
Member

Seems like a weird bug (and a hard one to reproduce): changing the last two lines in the MWE to

solver = PANOC(verbose=true, freq=1)
solver(x0; f=f, A=A, g=g)

then the iterations do stop as expected:

[...]
  135 | 4.750e-01 | 4.292e-08 | 1.000e+00
  136 | 4.750e-01 | 4.575e-08 | 1.000e+00
  137 | 4.750e-01 | 1.417e-08 | 1.250e-01
  138 | 4.750e-01 | 2.124e-07 | 1.250e-01
  139 | 4.750e-01 | 2.189e-07 | 7.813e-03
┌ Warning: stepsize `tau` became too small (0.0009765625), stopping the iterations
└ @ ProximalAlgorithms ~/.julia/dev/ProximalAlgorithms/src/algorithms/panoc.jl:182
julia> 

@nantonel
Copy link
Collaborator Author

Very strange!! We should check in Julia 1.2.. but I'm not going to update yet (waiting next week)

@nantonel
Copy link
Collaborator Author

Seems in the latest version the MWE below doesn't raise any warnings!
At least when using PANOC, ZeroFPR is still having some.

Stumbled upon this MWE

using StructuredOptimization
using Random
using ProximalAlgorithms: PANOC 
using ProximalOperators, AbstractOperators
using RecursiveArrayTools

Random.seed!(13)
n,m = 10,20
Y = randn(n,m)

A = [Eye(size(Y)) Eye(size(Y))]
x0 = ArrayPartition(zeros(size(Y)), zeros(size(Y)))

f = PrecomposeDiagonal(SqrNormL2(), 1.0, Y)
g1 = NormL1() 
g2 = IndBallRank(2) 
g = SeparableSum(g2,g1) 

solver = PANOC(verbose=true)
solver(x0; f=f, A=A, g=g)

maybe there's something simpler but better then nothing for the moment!

@lostella
Copy link
Member

I’m closing this, since using @warn or other builtin logging utilities already allows tuning the logging level, see e.g. disable_logging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants