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

also show the minimizer #1054

Closed
wants to merge 3 commits into from

Conversation

MariusDrulea
Copy link

@MariusDrulea MariusDrulea commented Oct 12, 2023

Currently the optimize function does show a candidate solution, but only the minimum of the function is shown. We shall also show the minimizer of the function, such that the provided info is complete.

Looks like this now:

 * Status: success (objective increased between iterations)

 * Candidate solution
    Minimizer:     [214.63875045325074, 207.70250063762063, 214.6387496819325, 60.99374379542592, -1.6462211405820447e-10, -2.329416881307505e-9, -2.8537271470976752e-8]
    Final objective value:     8.456923e-13

 * Found with
    Algorithm:     L-BFGS

 * Convergence measures
    |x - x'|               = 2.49e-12 ≤ 1.0e-07
    |x - x'|/|x'|          = 1.16e-14 ≰ 0.0e+00
    |f(x) - f(x')|         = 8.45e-19 ≰ 0.0e+00
    |f(x) - f(x')|/|f(x')| = 9.99e-07 ≰ 0.0e+00
    |g(x)|                 = 6.38e-06 ≰ 1.0e-07

 * Work counters
    Seconds run:   0  (vs limit Inf)
    Iterations:    46
    f(x) calls:    228
    ∇f(x) calls:   228

@annuges
Copy link
Contributor

annuges commented Nov 17, 2023

Just another user here so someone else will need to make that call but I don’t think printing the minimizer like that is a good idea.

While it might be fine for smaller problems dumping the entire Parameter vector of say a +100k parameter model into the console would be completely unusable.

@pkofod
Copy link
Member

pkofod commented Dec 12, 2023

We used to have this, and I must admit that I removed it because we had to default to showing at max 5 values or something like that, and at that point it gets quite useless for many real use cases. An alternative may of course be to show it in vertical alignment, but I think it's better for the user to just print Optim.minimizer(res) after the optimization run. I'm open to counter arguments of course. You could show it in more of a n x 5 grid that gets wrapped such that you only show 5 columns, but still, if you have hundreds of thousands of variables it will kill your terminal.

@pkofod
Copy link
Member

pkofod commented Jan 16, 2024

You're welcome to open this if you want to argue the case that it should be shown.

@pkofod pkofod closed this Jan 16, 2024
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

Successfully merging this pull request may close these issues.

4 participants