Closed stevencarlislewalker closed 2 years ago
By clamping the simulated values to a tolerance, just before they are used in the objective function, I can eliminate the NaNs for this and in another example from @wzmli. In particular I have done this:
Type clamping_tolerance = 1e-12;
Type clamped_simulated;
...
clamped_simulated = CppAD::CondExpLt(
simulated,
clamping_tolerance,
clamping_tolerance,
simulated
);
I'm not sure if this is a good idea because this will absolutely mess up the automatic derivatives ... the question is whether this will matter in practice??
I'm not seeing NaNs anymore with 14f6bf0
Fixed with this stuff
Currently this script returns NaN from an objective function produced by TMB. Please run this script from the root directory of the
McMasterPandemic
project.I'm not sure if this is a bug, but it is something that I would like to explain.
Importantly it doesn't cause a problem yet because the nlminb optimizer seems to be able to overcome NaNs that are encountered for particular parameter vectors along the path to finding the optimal parameter vector.