We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
finite_difference_jacobian
MWE:
using DiffEqFlux, Flux, Optim, OrdinaryDiffEq, Plots using LinearAlgebra function rober(du,u,p,t) y₁,y₂,y₃ = u k₁,k₂,k₃ = p du[1] = -k₁*y₁+k₃*y₂*y₃ du[2] = k₁*y₁-k₂*y₂^2-k₃*y₂*y₃ du[3] = k₂*y₂^2 nothing end u0 = Float32[1.0,0.0,0.0] prob = ODEProblem(rober,u0,(0f0,1f5),(4f-2,3f7,1f4)) t = 10f0 .^ (0:1f-1:5) ode_data = Array(solve(prob,Rodas5(), abstol=1e-6, reltol=1e-6, saveat=t)) dudt2 = FastChain(FastDense(3,16,tanh), StiffLayer(FastDense(16, 16, tanh), ExponentialScaling(16), FastDense(16, 16, tanh)), FastDense(16,3)) tend = 10f0 _tspan = (0f0,tend) _t = t[t .<= tend] n_ode = NeuralODE(dudt2,_tspan,Rodas5(autodiff=false),abstol=1e-6,reltol=1e-6,saveat=_t) function predict_n_ode(p) n_ode(u0,p) end function loss_n_ode(p) pred = (predict_n_ode(p)) loss = sum(abs2,ode_data[:,1:size(pred,2)] .- (pred)) loss,pred end loss_n_ode(n_ode.p) # n_ode.p stores the initial parameters of the neural ODE
Status:
[aae7a2af] DiffEqFlux v1.3.0 [587475ba] Flux v0.10.1 [429524aa] Optim v0.20.1 [1dea7af3] OrdinaryDiffEq v5.28.1 [91a5bcdd] Plots v0.28.4 [295af30f] Revise v2.5.0 [90137ffa] StaticArrays v0.12.1
The text was updated successfully, but these errors were encountered:
Sorry, wrong repository
Sorry, something went wrong.
No branches or pull requests
MWE:
Status:
The text was updated successfully, but these errors were encountered: