Giter VIP home page Giter VIP logo

Comments (6)

ChrisRackauckas avatar ChrisRackauckas commented on August 25, 2024

You can set the vjp in the ODEFunction constructor, and that would accelerate it. https://docs.sciml.ai/latest/analysis/sensitivity/#Adjoint-Sensitivity-Analysis-via-adjoint_sensitivities-(Backpropogation)-1 + https://docs.sciml.ai/latest/features/performance_overloads/#ODEFunction-1 is the documentation on this (though vjp is a new option that doesn't seem to be documented yet!).

Jacobian matrix ( df/dx )
Jacobian of the parameters (dF/dp)

You wouldn't want to compute those, you'd want to supply a method for computing the vector-jacobian product directly, which is provided by PyTorch. It would be good to get an example up and running...

from diffeqpy.

jiweiqi avatar jiweiqi commented on August 25, 2024

I am really a new Julia user, maybe it is a too simple question: in the document https://docs.sciml.ai/latest/analysis/sensitivity/#Adjoint-Sensitivity-Analysis-via-adjoint_sensitivities-(Backpropogation)-1, I have the following bugs

dg(out,u, i) = (out.=1.0.-u)
ts = [0.0,0.2,0.5,0.7]
res = adjoint_sensitivities(sol,Vern9(),dg,ts,abstol=1e-9,reltol=1e-6)

then it seems that the definition of dg has something wrong:

MethodError: no method matching dg(::SubArray{Float64,1,Array{Float64,1},Tuple{UnitRange{Int64}},true}, ::Array{Float64,1}, ::Array{Float64,1}, ::Float64, ::Int64)
Closest candidates are:
  dg(::Any, ::Any, ::Any) at In[26]:1
  dg(::Any, ::Any) at In[25]:1

from diffeqpy.

ChrisRackauckas avatar ChrisRackauckas commented on August 25, 2024

There was a docs typo. It should be dg(out,u,p,t,i) = (out.=1.0.-u)

from diffeqpy.

ChrisRackauckas avatar ChrisRackauckas commented on August 25, 2024

Did you find an adequate solution here? I think we should add it to the docs if you did.

from diffeqpy.

jiweiqi avatar jiweiqi commented on August 25, 2024

I haven't figure out yet. Calling python functions from Julia seems to be not a robust solution for me. Instead, I plan to re-implement the physical model using Julia, that will make life easier.

from diffeqpy.

ChrisRackauckas avatar ChrisRackauckas commented on August 25, 2024

Yeah, that's probably the easier route for now. Let me know if you need any help: I think I recall you're in the chatrooms so see you there.

from diffeqpy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.