Using Optim.Options (Syntax)

Hello!
I am fitting curves with 2 parameters and I’m using Optim.optimize; especially the LBFGS method because there are lower and upper bounds.

—snip—
Optim.optimize(par -> Loss(Testdata, par), [0.005, 0.00001], [10000.0, 5.0], [0.8, 0.1])
—snap—

This works fine, but now I tried to use the Optim.Options (for example show_trace) - But I get some errors:

—snip—
Optim.optimize(par -> Loss(Testdata, par), [0.005, 0.00001], [10000.0, 5.0], [0.8, 0.1], Optim.Options(show_trace=true))
ERROR: MethodError: objects of type Array{Float64,1} are not callable
Use square brackets for indexing an Array.
—snap—

By the way: What is the correct syntax to correctly determine the input, something like
—snip—
Optim.optimize(par -> Loss(Testdata, par), lower_bound=[0.005, 0.00001], upper_bound=[10000.0, 5.0], init_val=[0.8, 0.1])
—snap—

Edit:
This works:
—snip—
Optim.optimize(par -> Loss(Testdata, par), [0.005, 0.00001], [10000.0, 5.0], [0.8, 0.1], Fminbox(LBFGS()), Optim.Options(show_trace=true))
—snap—

Many thanks in advance,
Holger

Good to know you figured it out without help! Just a comment FWIW, you can use triple backticks (```) for code blocks in your messages on discourse, and even specify the language, so your last edit written as

```julia
Optim.optimize(par -> Loss(Testdata, par), [0.005, 0.00001], [10000.0, 5.0], [0.8, 0.1], Fminbox(LBFGS()), Optim.Options(show_trace=true))
```

would look like

Optim.optimize(par -> Loss(Testdata, par), [0.005, 0.00001], [10000.0, 5.0], [0.8, 0.1], Fminbox(LBFGS()), Optim.Options(show_trace=true))
1 Like