Skip to content

ProgressMeter #442

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

Closed
cortner opened this issue Jun 30, 2017 · 5 comments
Closed

ProgressMeter #442

cortner opened this issue Jun 30, 2017 · 5 comments

Comments

@cortner
Copy link
Contributor

cortner commented Jun 30, 2017

Reviving #84

printing the iteration history is useful when you are developing and experimenting, but as user you probably don't want to see it and still get some progress information?

Here are two variants I cooked up, which I both like, and both can probably be fine-tuned quite nicely.

using ProgressMeter
prog = ProgressThresh(1e-8, "Minimizing:")
df(x) = 4*x^3 - 2*x + 0.8
x = 1.0
h = 0.1
while df(x) > 1e-8
  x -= h * df(x)
  ProgressMeter.update!(prog, abs(df(x)))
  sleep(0.3)
end
using ProgressMeter
TOL = 1e-8
GRAN = 100
prog = Progress(floor(Int, GRAN * abs(log(TOL))), desc = "Minimizing:")
df(x) = 4*x^3 - 2*x + 0.8
x = 1.0
h = 0.1
while df(x) > TOL
  x -= h * df(x)
  ProgressMeter.update!(prog, ceil(Int, GRAN * abs(log(abs(df(x))))))
  sleep(0.3)
end
@antoine-levitt
Copy link
Contributor

Very nice! I like the first solution a lot more, because it does not pretend that the norm of the gradient is an accurate representation of progress (which it is usually not, unless you do gradient descent or a similarly "nice" method with a tight tolerance). Maybe displaying the value of the function to be optimized would be nice also? show_trace could become a flag: True prints to STDOUT, :progress does this, and False does nothing.

@cortner
Copy link
Contributor Author

cortner commented Jun 30, 2017

yeah, the second one was more tongue in cheek.

I think the first version with a little more information will be great

@pkofod
Copy link
Member

pkofod commented Jun 30, 2017

Looks great!

@aakhmetz
Copy link

aakhmetz commented Feb 1, 2020

looks indeed great!

@pkofod
Copy link
Member

pkofod commented Aug 18, 2020

I think this will probably be a callback thing if anything and thus up to the user.

@pkofod pkofod closed this as completed Aug 18, 2020
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

4 participants