Git Product home page Git Product logo

coexist.jl's People

Contributors

aa25desh avatar chrisrackauckas avatar dinskid avatar ishdutt avatar vollmersj avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

ishdutt dinskid

coexist.jl's Issues

modelingtoolkitize - throws error

sys = modelingtoolkitize(prob) at code line
throws

ERROR: TensorOperations.IndexError{String}("invalid permutation of length 1: (1, 2, 3, 4)")
Stacktrace:
 [1] contract!(::Bool, ::Array{Operation,1}, ::Symbol, ::Array{Float64,7}, ::Symbol, ::Bool, ::SubArray{Float64,3,Array{Float64,4},Tuple{Int64,Base.Slice{Base.OneTo{Int64}},Base.Slice{Base.OneTo{Int64}},Base.Slice{Base.OneTo{Int64}}},true}, ::Tuple{}, ::NTuple{4,Int64}, ::Tuple{Int64,Int64,Int64}, ::NTuple{4,Int64}, ::Tuple{Int64,Int64,Int64}, ::Tuple{Symbol,Symbol,Symbol}) at /Users/vollmer/.julia/packages/TensorOperations/PuhjE/src/implementation/stridedarray.jl:262
 [2] contract!(::Bool, ::Array{Operation,1}, ::Symbol, ::Array{Float64,7}, ::Symbol, ::Bool, ::SubArray{Float64,3,Array{Float64,4},Tuple{Int64,Base.Slice{Base.OneTo{Int64}},Base.Slice{Base.OneTo{Int64}},Base.Slice{Base.OneTo{Int64}}},true}, ::Tuple{}, ::NTuple{4,Int64}, ::Tuple{Int64,Int64,Int64}, ::NTuple{4,Int64}, ::Tuple{Int64,Int64,Int64}, ::Tuple{}, ::Tuple{Symbol,Symbol,Symbol}) at /Users/vollmer/.julia/packages/TensorOperations/PuhjE/src/implementation/stridedarray.jl:85
 [3] f!(::Array{Any,1}, ::Array{Operation,1}, ::Array{Any,1}, ::Operation) at /Users/vollmer/covidwarwick/coexist_julia/julia/highlevel.jl:89
 [4] (::ODEFunction{true,typeof(f!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing})(::Array{Any,1}, ::Vararg{Any,N} where N) at /Users/vollmer/.julia/packages/DiffEqBase/BZxEO/src/diffeqfunction.jl:248
 [5] modelingtoolkitize(::ODEProblem{Array{Float64,4},Tuple{Float64,Float64},true,DiffEqBase.NullParameters,ODEFunction{true,typeof(f!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Symbol,Nothing,Tuple{Symbol},NamedTuple{(:p,),Tuple{Nothing}}},DiffEqBase.StandardODEProblem}) at /Users/vollmer/.julia/packages/ModelingToolkit/aKa4S/src/systems/diffeqs/modelingtoolkitize.jl:19
 [6] top-level scope at none:0

To keep track of functions.

  • regroup_by_age
  • build_paramDict
  • paramDict_toTable
  • paramTable_toDict
  • adjustRatesByAge_KeepAverageRate
  • trFunc_travelInfectionRate_ageAdjusted
  • trFunc_newInfections_Complete
  • trFunc_HospitalAdmission
  • trFunc_HospitalDischarge
  • trFunc_diseaseProgression
  • inpFunc_testSpecifications
  • trFunc_testCapacity
  • inpFunc_testingDataCHESS_PCR
  • f_symptoms_nonCOVID
  • distTestsSymp
  • policyFunc_testing_symptomaticOnly
  • policyFunc_testing_massTesting_with_reTesting
  • trFunc_testing
  • trFunc_quarantine_caseIsolation
  • dydt_Complete
  • solveSystem
  • getBetaStd
  • getEnsembleParamSampleDistance
  • getGPR_prediction
  • joinDataAndSimCurves
  • getNegBinomParams
  • NegBinom_logpmf
  • likFunc_deaths
  • likFunc_newHospPositive
  • getLikelihoodsWithStartDates
  • runAll
  • gpSelectionFunction

To verify the working of build_paramDict

I've added code to build the parameter dictionary in #26
I've made use of ReExes to extract the parameters from the source code and used Julia's meta programming to convert them into julia objects.
Please verify the working of the code and suggest if there is any better way to do it.
I wasn't able to get the RE for extracting the params whenever nested () where there (I wasn't quite able to write recursive REs to do the same), so I used a rudimentary way to extract it.
FYI, in python we make use of inspect.

modelingtoolkitize does not like reshape

sys = modelingtoolkitize(prob) throws an error on

stateTensor=reshape(stateTensor_vec,(nAge, nHS, nIso, nTest))

ERROR: MethodError: no method matching Float64(::Operation)
Closest candidates are:
Float64(::T) where T<:Number at boot.jl:715
Float64(::Int8) at float.jl:60
Float64(::Int16) at float.jl:60
...
Stacktrace:

using ModelingToolkit
using DifferentialEquations



nIso=4
nTest=4
nHS=8
nAge=9

x=1
# yeah

ssize=(nAge, nHS, nIso, nTest)


function f_vec!(dstateTensor_vec,stateTensor_vec,p,t)
  dstateTensor=reshape(dstateTensor_vec,(nAge, nHS, nIso, nTest))
  stateTensor=reshape(stateTensor_vec,(nAge, nHS, nIso, nTest))
  trTensor_complete = zeros((nAge, nHS, nIso, nTest, nHS, nIso, nTest))
  for iso=1:nIso
    for ag=1:nAge
      for hs=1:nHS
        for tst=1:nTest
          for nhs=1:nHS #new health state
              trTensor_complete[ag,hs,iso,tst,nhs,iso,tst]+=1.0
          end
        end
      end
    end
  end
  dstateTensor=zeros((nAge, nHS, nIso, nTest))

  for ag=1:nAge
    for hs=1:nHS
      for iso=1:nIso
        for tst=1:nTest
          for nhs=1:nHS
            for niso=1:nIso
              for ntst=1:nTest
                dstateTensor[ag,hs,iso,tst]+=stateTensor[1,nhs,niso,ntst,]* trTensor_complete[ag,nhs,niso,ntst,hs,iso,tst]
              end
            end
          end
        end
      end
    end
  end
  dstate[:]=reshape(dstateTensor,(nIso*nAge*nHS*nTest))
end

n=prod([ssize...])
prob = ODEProblem(f_vec!,100*ones(n),(0.0,80.0),p=nothing)
sys = modelingtoolkitize(prob)

passing parameters

Is the best way to pass parameter to use name tupleNamedTuple such as

(;  social_distiance= (;lockdown_lift=Date("2020-06-01")) )

Improving accuracy of methods

We are still using โ‰ˆ to test few of our methods.

  • trFunc_HospitalAdmission

  • trFunc_newInfections_Complete

  • trFunc_HospitalDischarge

  • trFunc_travelInfectionRate_ageAdjusted

To find a parallel of einsum in Julia.

  • 'ijl,j->i'

  • 'ijk,j->ik'

  • 'ijkj->ijk'

  • 'ijkl,j->i'

  • 'ijlml->ijlm'

  • 'iklkl->ikl'

  • 'ijljl->ijl'

  • 'ijkljkm->ijklm'

  • '...jkl->...'

  • 'ijkl,ijklmnp->imnp'

  • 'ijkljkl->ijkl'

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.