The recommended method is to use
build_loss_objective with the optimizer of your choice. This method can thus be paired with global optimizers from packages like BlackBoxOptim.jl or NLopt.jl which can be much less prone to finding local minima than local optimization methods. Also, it allows the user to define the cost function in the way they choose as a function
loss(sol), and thus can fit using any cost function on the solution, making it applicable to fitting non-temporal data and other types of problems. Also,
build_loss_objective works for all of the
DEProblem types, allowing it to optimize parameters on ODEs, SDEs, DDEs, DAEs, etc.
However, this method requires repeated solution of the differential equation. If the data is temporal data, the most efficient method is the
two_stage_method which does not require repeated solutions but is not as accurate. Usage of the
two_stage_method should have a post-processing step which refines using a method like