I’m using Optim.optimize()
to estimate a likelihood-type model. Having read that autodiff
is a great feature, I have implemented it. I have three questions that I’m hoping someone can shed more light on.
For reference, the function I’m working with (and the code I’m using) is posted in this gist.
-
I get the impression that taking advantage of
autodiff
uses more memory in theoptimize()
call than would an equivalent user-provided gradient. Is this true? -
The reason I ask the first question is because I’m worried my code is using too much memory. Basically, when I run it with
@time
, I get the following summary:
11.534809 seconds (907.69 k allocations: 7.605 GiB, 12.97% gc time)
This seems like a large amount of memory, but I’m not sure. One of the data arrays that enters the objective function is xg
, which when I send it to Base.summarysize()
, I get 4395600
returned, which I believe means 4.3956 GB. If that’s true, is it still the case that Optim.optimize()
is using too much memory?
- I noticed that the memory allocations were much bigger if I let the optimizer run for a longer amount of time (e.g. by increasing the strictness of
g_tol
orf_tol
, etc.). Does anyone know why that might be?
I thank you in advance for any illumination you can provide.