Skip to content

Instantly share code, notes, and snippets.

@khannay
Last active April 23, 2020 13:57
Show Gist options
  • Save khannay/db7cc24699ec4ac972d5d2d1b23253c4 to your computer and use it in GitHub Desktop.
Save khannay/db7cc24699ec4ac972d5d2d1b23253c4 to your computer and use it in GitHub Desktop.
Lotka_volterra fitting
function train_model(;pguess=[0.8,1.2,1.2,1.0,2.9,1.1])
println("The initial loss function is $(loss_adjoint(pguess)[1])")
#Train the ODE
resinit=DiffEqFlux.sciml_train(loss_adjoint,pguess,ADAM(), maxiters=3000)
res = DiffEqFlux.sciml_train(loss_adjoint,resinit.minimizer,BFGS(initial_stepnorm = 1e-5))
println("The parameters are $(res.minimizer) with final loss value $(res.minimum)")
return(res)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment