Skip to content
New issue

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

training method for multiple neural-nets in universal ODEs #31

Closed
yewalenikhil65 opened this issue Dec 15, 2020 · 2 comments
Closed

training method for multiple neural-nets in universal ODEs #31

yewalenikhil65 opened this issue Dec 15, 2020 · 2 comments

Comments

@yewalenikhil65
Copy link

what is the way of training multiple neural-nets in universal ODEs . Do we train them together (if yes , how ?) or do we train them subsequently ?

NN_1 = FastChain(FastDense(2,32,tanh), FastDense(32,32,tanh),FastDense(32,1)) 
p1 = initial_params(NN_1)
NN_2 = FastChain(FastDense(2,32,tanh), FastDense(32,32,tanh),FastDense(32,1)) 
p2 = initial_params(NN_1)

function dudt_(u, p,t)
    x, y, z = u
    z1 = NN_1([x,y],p1)
    z2 = NN_2([y,z],p2)
    [p_[1]*x + z[1],
    -p_[3]*y + z[2],
     p_[4]*z - z[1] - z[2]
      ]
end # where p_[1], p_[3],p_[4] are known parameters passed through p

prob_nn = ODEProblem(dudt_,u0, tspan, p)
sol_nn = solve(prob_nn)

function predict()  # etc..etc
function loss()

How do I update/ train NN_1 and NN_2 together using say sci_ml if thats how I should proceed ?

@yewalenikhil65 yewalenikhil65 changed the title training methods multiple neural-nets in universal ODEs training method for multiple neural-nets in universal ODEs Dec 15, 2020
@ChrisRackauckas
Copy link
Owner

p = [p1;p2] and then split in dudt_ via a @view. Let me know if you think this needs a tutorial

@ChrisRackauckas
Copy link
Owner

I can't seem to transfer this issue so I'm going to close it, but I'm tracking it for a tutorial at SciML/DiffEqFlux.jl#459

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants