GithubHelp home page GithubHelp logo

Comments (6)

agerlach avatar agerlach commented on August 16, 2024

Your u0s_dis and in turn gd should only be over the uncertain variables. The h function is then used to either perform a change of variables or to combine those elements into the full state initial condition and parameter vectors.

u0s_dis = [cor_dist_1,cor_dist_2,cor_dist_3]
gd = GenericDistribution(u0s_dis...)
h(x,u,p) = [x; @views u[4:6]], p

from scimlexpectations.jl.

lakshaya17 avatar lakshaya17 commented on August 16, 2024

Thank you for the reply.

That means, we are including the rest of the states (3 non-uncertain states) with the previously defined 3 uncertain states in by using u[4:6] in h(x,u,p) = [x; @views u[4:6]], p. Thereby, making the final solution in the as the 6-state variables. Did I understand that correctly?

Regards

from scimlexpectations.jl.

agerlach avatar agerlach commented on August 16, 2024

from scimlexpectations.jl.

lakshaya17 avatar lakshaya17 commented on August 16, 2024

I see. Again, thank you so much for your help.

It's working now.

from scimlexpectations.jl.

lakshaya17 avatar lakshaya17 commented on August 16, 2024

InexactError: Int64(33.964214570007954)

Some of the types have been truncated in the stacktrace for improved reading. To emit complete information
in the stack trace, evaluate TruncatedStacktraces.VERBOSE[] = true and re-run the code.

Stacktrace:
[1] Int64
@ .\float.jl:788 [inlined]
[2] convert
@ .\number.jl:7 [inlined]
[3] setindex!
@ .\array.jl:966 [inlined]
[4] unsafe_copyto!(dest::Vector{Int64}, doffs::Int64, src::Vector{Float64}, soffs::Int64, n::Int64)
@ Base .\array.jl:253
[5] unsafe_copyto!
@ .\array.jl:307 [inlined]
[6] copyto_impl!
@ .\array.jl:331 [inlined]
[7] copyto!
@ .\array.jl:317 [inlined]
[8] copyto!
@ .\array.jl:343 [inlined]
[9] copyto_axcheck!
@ .\abstractarray.jl:1127 [inlined]
[10] Array
@ .\array.jl:626 [inlined]
[11] convert
@ .\array.jl:617 [inlined]
[12] (::SystemMap{ODEProblem{true,Vector{Int64},Tuple{Float64, Float64},…}, Tuple{Tsit5{Static.False,…}}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}})(u0::Vector{Float64}, p::Vector{Float64})
@ SciMLExpectations C:\Users\lakshay.julia\packages\SciMLExpectations\DWytJ\src\system_utils.jl:19
[13] (::SciMLExpectations.var"#14#15"{GenericDistribution{SciMLExpectations.var"#pdf_func#4"{Tuple{Uniform{Float64}, Uniform{Float64}}}, SciMLExpectations.var"#rand_func#6"{Tuple{Uniform{Float64}, Uniform{Float64}}}, StaticArraysCore.SVector{2, Float64}, StaticArraysCore.SVector{2, Float64}}, typeof(h), typeof(g), SystemMap{ODEProblem{true,Vector{Int64},Tuple{Float64, Float64},…}, Tuple{Tsit5{Static.False,…}}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}})(x::StaticArraysCore.SVector{2, Float64}, p::ArrayPartition{Float64, Tuple{Vector{Int64}, Vector{Float64}}})
@ SciMLExpectations C:\Users\lakshay.julia\packages\SciMLExpectations\DWytJ\src\expectation.jl:48
[14] #41
@ C:\Users\lakshay.julia\packages\Integrals\9qNWp\src\Integrals.jl:149 [inlined]
[15] (::HCubature.GenzMalik{2, Float64})(f::Integrals.var"#41#43"{IntegralProblem{false, ArrayPartition{Float64, Tuple{Vector{Int64}, Vector{Float64}}}, SciMLExpectations.var"#14#15"{GenericDistribution{SciMLExpectations.var"#pdf_func#4"{Tuple{Uniform{Float64}, Uniform{Float64}}}, SciMLExpectations.var"#rand_func#6"{Tuple{Uniform{Float64}, Uniform{Float64}}}, StaticArraysCore.SVector{2, Float64}, StaticArraysCore.SVector{2, Float64}}, typeof(h), typeof(g), SystemMap{ODEProblem{true,Vector{Int64},Tuple{Float64, Float64},…}, Tuple{Tsit5{Static.False,…}}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}}, StaticArraysCore.SVector{2, Float64}, StaticArraysCore.SVector{2, Float64}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}}, a::StaticArraysCore.SVector{2, Float64}, b::StaticArraysCore.SVector{2, Float64}, norm::typeof(LinearAlgebra.norm))
@ HCubature C:\Users\lakshay.julia\packages\HCubature\QvyJW\src\genz-malik.jl:130
[16] hcubature
(f::Integrals.var"#41#43"{IntegralProblem{false, ArrayPartition{Float64, Tuple{Vector{Int64}, Vector{Float64}}}, SciMLExpectations.var"#14#15"{GenericDistribution{SciMLExpectations.var"#pdf_func#4"{Tuple{Uniform{Float64}, Uniform{Float64}}}, SciMLExpectations.var"#rand_func#6"{Tuple{Uniform{Float64}, Uniform{Float64}}}, StaticArraysCore.SVector{2, Float64}, StaticArraysCore.SVector{2, Float64}}, typeof(h), typeof(g), SystemMap{ODEProblem{true,Vector{Int64},Tuple{Float64, Float64},…}, Tuple{Tsit5{Static.False,…}}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}}, StaticArraysCore.SVector{2, Float64}, StaticArraysCore.SVector{2, Float64}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}}, a::StaticArraysCore.SVector{2, Float64}, b::StaticArraysCore.SVector{2, Float64}, norm::typeof(LinearAlgebra.norm), rtol
::Float64, atol::Float64, maxevals::Int64, initdiv::Int64)
@ HCubature C:\Users\lakshay.julia\packages\HCubature\QvyJW\src\HCubature.jl:61
[17] #hcubature#3
@ C:\Users\lakshay.julia\packages\HCubature\QvyJW\src\HCubature.jl:179 [inlined]
[18] __solvebp_call(prob::IntegralProblem{false, ArrayPartition{Float64, Tuple{Vector{Int64}, Vector{Float64}}}, SciMLExpectations.var"#14#15"{GenericDistribution{SciMLExpectations.var"#pdf_func#4"{Tuple{Uniform{Float64}, Uniform{Float64}}}, SciMLExpectations.var"#rand_func#6"{Tuple{Uniform{Float64}, Uniform{Float64}}}, StaticArraysCore.SVector{2, Float64}, StaticArraysCore.SVector{2, Float64}}, typeof(h), typeof(g), SystemMap{ODEProblem{true,Vector{Int64},Tuple{Float64, Float64},…}, Tuple{Tsit5{Static.False,…}}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}}, StaticArraysCore.SVector{2, Float64}, StaticArraysCore.SVector{2, Float64}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, alg::HCubatureJL{typeof(LinearAlgebra.norm)}, sensealg::Integrals.ReCallVJP{Integrals.ZygoteVJP}, lb::StaticArraysCore.SVector{2, Float64}, ub::StaticArraysCore.SVector{2, Float64}, p::ArrayPartition{Float64, Tuple{Vector{Int64}, Vector{Float64}}}; reltol::Float64, abstol::Float64, maxiters::Int64)
@ Integrals C:\Users\lakshay.julia\packages\Integrals\9qNWp\src\Integrals.jl:158
[19] #__solvebp#35
@ C:\Users\lakshay.julia\packages\Integrals\9qNWp\src\Integrals.jl:123 [inlined]
[20] #solve#34
@ C:\Users\lakshay.julia\packages\Integrals\9qNWp\src\Integrals.jl:108 [inlined]
[21] integrate(quadalg::HCubatureJL{typeof(LinearAlgebra.norm)}, adalg::NonfusedAD, f::Function, lb::StaticArraysCore.SVector{2, Float64}, ub::StaticArraysCore.SVector{2, Float64}, p::ArrayPartition{Float64, Tuple{Vector{Int64}, Vector{Float64}}}; nout::Int64, batch::Int64, kwargs::Base.Pairs{Symbol, Real, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:reltol, :abstol, :maxiters), Tuple{Float64, Float64, Int64}}})
@ SciMLExpectations C:\Users\lakshay.julia\packages\SciMLExpectations\DWytJ\src\expectation.jl:148
[22] solve(::ExpectationProblem{SystemMap{ODEProblem{true,Vector{Int64},Tuple{Float64, Float64},…}, Tuple{Tsit5{Static.False,…}}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, typeof(g), typeof(h), GenericDistribution{SciMLExpectations.var"#pdf_func#4"{Tuple{Uniform{Float64}, Uniform{Float64}}}, SciMLExpectations.var"#rand_func#6"{Tuple{Uniform{Float64}, Uniform{Float64}}}, StaticArraysCore.SVector{2, Float64}, StaticArraysCore.SVector{2, Float64}}, ArrayPartition{Float64, Tuple{Vector{Int64}, Vector{Float64}}}}, ::Koopman{NonfusedAD}; maxiters::Int64, batch::Int64, quadalg::HCubatureJL{typeof(LinearAlgebra.norm)}, ireltol::Float64, iabstol::Float64, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ SciMLExpectations C:\Users\lakshay.julia\packages\SciMLExpectations\DWytJ\src\expectation.jl:134
[23] solve(::ExpectationProblem{SystemMap{ODEProblem{true,Vector{Int64},Tuple{Float64, Float64},…}, Tuple{Tsit5{Static.False,…}}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, typeof(g), typeof(h), GenericDistribution{SciMLExpectations.var"#pdf_func#4"{Tuple{Uniform{Float64}, Uniform{Float64}}}, SciMLExpectations.var"#rand_func#6"{Tuple{Uniform{Float64}, Uniform{Float64}}}, StaticArraysCore.SVector{2, Float64}, StaticArraysCore.SVector{2, Float64}}, ArrayPartition{Float64, Tuple{Vector{Int64}, Vector{Float64}}}}, ::Koopman{NonfusedAD})
@ SciMLExpectations C:\Users\lakshay.julia\packages\SciMLExpectations\DWytJ\src\expectation.jl:125
[24] top-level scope
@ In[19]:1

Now it is giving me this issue. It was working before.

from scimlexpectations.jl.

agerlach avatar agerlach commented on August 16, 2024

Are you able to solve your ODEProblem directly, e.g. solve(prob, Tsit5())? I suspect that the initial condition you are giving it is an Int vector. It will need to be able to handle floats.

from scimlexpectations.jl.

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.